Skip to main content

File transfer with rsync, SCP, or SFTP

Using rsync, scp or sftp you can copy files from your local machine to a KTH shell server. This is also the easiest way to transfer files to your AFS home directory, or to upload files to your personal KTH webpage.

All of these applications use variants of the SSH protocol for secure data transfer. In normal Linux and Unix environments, ssh settings for remote login will also be used by scp and sftp.

Note: Examples below assume that you have configured your SSH settings. See Linux  or macOS .

Any of the shell servers  can be used to transfer files. If you have previously used sftp.sys.kth.se (an alias to a legacy shell server), use the server for your affilation instead; all servers use the same home directories (in AFS).

To upload files to your personal KTH webpage, just place them in the directory public_html. They will then be accessible from https://people.kth.se/~username/.

Transfer from local machine to KTH

You can transfer a single file to Private in your AFS home directory, using the server name from your local ~/.ssh/config:

kinit -f username@KTH.SE ## if you do not already have tickets
scp <localfile> student-shell:~/Private/

or all contents of the local project directory to classes/ab1234/project/

rsync -av project student-shell:classes/ab1234/

Note that for rsync, you must keep track of trailing slashes:

  • using project/ (extra slash) would mean "copy contents of directory" rather than "copy the directory"
  • using student-shell:classes/ab1234 (no slash) would mean "copy project/* into ab1234/*" rather than "… into ab1234/project/*"

See Usage section of the man page (external link)

You can also transfer files using sftp, but must then keep track of both local directory (lcd, lpwd) and remote directory (cd, pwd), and use put/get to upload and download files respectively.

Transfer from KTH to local machine

Both scp and rsync work in either direction. Just put the remote path first to download to the local machine.

kinit -f username@KTH.SE                    ## if you do not already have tickets
scp student-shell:~/Private/<remotefile> .  ## NB: "." = current directory
rsync -av student-shell:classes kth-classes/

Graphical clients

Linux

Most file managers in Linux and Unix systems can use sftp. If you enter the "directory" name sftp://student-shell/ (using the name set in ~/.ssh/config) you can drag-and-drop files between that window and others on your system.

macOS

Cyberduck is available in KTH Mac, or from Cyberduck's website (external link) . Unfortunately, it cannot use Kerberos (GSSAPI), which limits you to the shell servers that allow password login.

Cyberduck

Windows

In Windows, PuTTY will install command-line tools PSCP and PSFTP, which work similarly to scp/sftp above, except that you need to load a saved session to get the correct settings ( GSSAPI options toggled as for SSH ). See -load «sessionname» in the documentation.

You can also use WinSCP. Unfortunately it lacks full support for Kerberos (GSSAPI), which may limit you to the shell servers that allow password login.

See also: How to remotely access KTH's SMB/Cifs storage  if you want to remotely access your Windows home directory.