Revision 5 as of 2020-09-10 12:22:30

Clear message

The File Transfer Method

The classic historic example for this method is the FTP program. Unfortunately it uses plain text passwords which goes over the net unencrypted, therefore it is notrecommend for access of personal files, and in fact is as well anymore possible. The SSH protocol does not suffer from this problem. It provides an encrypted channel between two computers, which can be used for interactive work as well as for file transfer.

SSH for file transfer on Unix

For simple file copying you can use the scp command. It is part of the (open)ssh package.

the first example copies a single file from top-level directory of your D-ITET account into the current directory (Note the dot). The second one copies a whole directory. For more information on scp check its manpage.

scp -p username@login.ee.ethz.ch:myfile.txt .
scp -rp username@login.ee.ethz.ch:topleveldir/ .

There are several other utilities which use ssh to provide the communication channel but implement their own file transfer methods. The most popular is probably rsync. It usees ssh to connect to the remote host. The nice thing about rsync is that it will only transfer data which is not already present on the local computer. This means you can repeatedly copy a whole directory and rsync will only transfer the changes. It does this even within files, so if you have a 200 MB file and change 10 bytes rsync will find them and only transfer a few bytes. To further improve performance rsync can also use the --compress option to compress the data for transfer.

Rsync transfers data only in one direction. This means that you have to be careful when synchronizing directories between two machines. The UNISON tool on the other hand is capable of synchronizing in two directions at once. I use this to keep my Tardis account and my laptop synchronized. Unison can be setup so that it will display a list of files that have been modified and in which direction they are going to be transfered. When the files have been modified at both ends it will even offer to use an external merging program to unify the files. For large files with small changes, Unison will also only transfer the changes within the file. Read all about it on The Unison Website. Unison is already installed on Tardis and on the ISG.EE Debian Image.

SSH for file transfer on Windows

There are Windows ports of scp, rsync and unison available, so you could use the same approach as on Unix. A more Windows like approach is to use the windows scp client from http://winscp.sourceforge.net/eng/. It offers an explorer like file access facility for transferring files to and from your tardis account in exactly the same way as you are used to, with explorer on the local filesystem.


CategoryEDUC