Rsync over SSH

In thi sarticle I'll explain how to backup your server or desktop machine over SSH with rsync. For those that have no clue about rsync here is a brief description taken from wikipedia: rsync is a software application for Unix systems which synchronizes files and directories from one location to another while minimizing data transfer using delta encoding when appropriate. An important feature of rsync not found in most similar programs/protocols is that the mirroring takes place with only one transmission in each direction. rsync can copy or display directory contents and copy files, optionally using compression and recursion.

Prior to any cron installation always remember to test that your command is running fine. Make a simple test:
$ rsync -avz -e ssh remoteuser@remotehost:/remote/dir /this/dir/

Remember to type in remoteuser@remotehost's password when prompted. I do need to make sure that remoteuser has read permissions to /remote/dir/ on remotehost, and that thisuser has write permissions to /this/dir/ on thishost. Also, 'rsync' and 'ssh' should be in this user's path (use "which ssh" and "which rsync"), 'rsync' should be in remoteuser's path, and 'sshd' should be running on remotehost.

That's all. I'll examine in an upcoming article how to automatically allow public keys in order to avoid typing each time the password.

Posted on: 03/02/2010








0 Comments
If you want to leave a comment please Login or Register