Remote Data Backup - Users Guide

Rsync for LINUX (Red Hat)


As the user you are going to be running rsync as, and on the machine you will be running rsync on, type:
ssh-keygen -t rsa
Follow the prompts and use the defaults for the filenames it gives you. Don't enter in a passphrase. You should then have two new files in ~/.ssh, id_rsa and


Now, upload the newly created key to your account with this command:
scp -P SSH_PORT# ~/.ssh/ USERANME@HOSTNAME:.ssh/authorized_keys


Note: The directory ".ssh" must have permission set to 0700, and the file "authorized_keys" must have permissions set to "0600" bofore the key to work. To check or change permissions, login with WinSCP, right click the file or directory, choose 'Propeties', and under 'Permissions' change them as needed.


Backing Up Files
At the command prompt type the following command:
rsync -avr -e 'ssh -p SSH_PORT# -i ~.ssh/id_rsa' files-to-backup USERNAME @HOSTNAME:backups


The "-avr" of the command stands for:
  • a: archive, preserves all attributes like ownership, timestamps, etc
  • v: verbose output
  • r: recursive, recurse into directories


Extra Rsync Command Line Options
Add any of these commands after the '-avr' command. You may include as many of these commands as you want.
  • --delete
    This will delete files remotely that no longer exist locally.


  • --exclude='*.jpg'
    This will exclude all files having the jpg extension


  • --include='*.jpg'
    This will include files having the jpg extension


  • --progress
    Shows you the progress of all the files that are being synced


  • --dry-run
    Shows what would have been transferred, but does not transfer anything


Automate with Cron
Create a batch file as shown below by using a text editor:



rsync -avr -e 'ssh -p SSH_PORT# -i ~.ssh/id_rsa' FILES-TO-BACKUP USERNAME @HOSTNAME:backups


Save the file as "".
Change permissions of "" to 0755.


Create a cron job to run the shell script at a specific time (7 pm, on every day). Example below.
0 19 * * * ./path-to-shell-script/
Vulnerability Scanner