HomeUNIXUNIX softwareRsync over SSH

Rsync over SSH

The combination of rsync and ssh is a very efficient and secure method of moving and backing up data.


In many of our projects, we use rsync over ssh to move data from one machine to another. The most common use is of the backup of data. However, we have used it for synchronizing data across servers and keeping track of log files.

Rsync is the utility that will copy files from one machine to another. In addition, rsync will determine if it needs to copy the entire file or just the changes. This makes rsync very fast on subsequent transfers.

This tutorial was assembled using Cygwin’s rsync package on a Microsoft Windows XP machine. Your syntax may be slightly different on other platforms.

The following command will copy the dirname directory and its contents to the remote machine, in the specified path:

rsync -avz -e ssh dirname user@remote:/desired/path

Slightly modified, the command will establish an ssh connection to “firsthost”, then launch rsync over SSH to “secondhost”, and finally copydirname to the desired path:

ssh user@firsthost rsync -avz -e ssh dirname user@secondhost:/desired/path

When combined with SSH public key authentication, it is possible to automate (cron) backups over the SSH secure connection without a password.

NOTE: The rsync parameters are defined as follows:

  • a = archive
  • v = verbose
  • z = compress file data
  • e = specifies remote shell to use
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

LATEST REVIEWS

Recent Comments

error: Content is protected !!