SSH comes with 2 applications for remote file transfer, namely scp and sftp. You can also use SSH to secure your rsync session.

The easiest of these are scp. The command is quite similar to cp in copying local files except that you’ll have to specify the remote user and host in your command. For example,

scp myfile.txt [email protected]:/remote/folder/

will copy myfile.txt from your local folder to /remote/folder in remoteuser need to exist and have write permission to /remote/folder/ in the remote system.

sftp in the other hand works almost exactly like ftp but with secure connection. Most of the commands are similar and can be used interchangeably. The following sftp example will work exactly as ftp would.

$ sftp [email protected]
Connected to
sftp> dir
file1      file2  file3   
sftp> pwd
Remote working directory: /home/user
sftp> get file2
Fetching /home/user/file2 to file2
/home/user/file2                                                   100% 3740KB 747.9KB/s   00:05    
sftp> bye

You can also use ssh to secure your rsync session. To do this, use –rsh=ssh or -e “ssh” with your normal rsync commands. The following 2 commands will work exactly the same;

rsync -av --delete --rsh=ssh /path/to/source [email protected]:/remote/folder/
rsync -av --delete -e "ssh" /path/to/source [email protected]:/remote/folder/