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 uses 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. Please consult the rsync(1) manpage for any details.

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. 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 transferred. 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.

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 Linux. 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 D-ITET account in exactly the same way as you are used to, with explorer on the local filesystem.

SSH File System (sshfs)

sshfs is a FUSE filesystem using SSH. It is available on most of the Linux distributions.

$ mkdir ~/tardis-home
$ sshfs username@login.ee.ethz.ch: ~/tardis-home

Now it is possible to operate on it as on any other (local) filesystem and so you can transfer data from one to another directory.

You can also unmount it again by typing:

$ fusermount -u ~/tardis-home


CategoryEDUC

Services/FileAccess/FileTransfer (last edited 2020-09-10 12:44:20 by bonaccos)