by namhuy.net
Rsync is a free software computer program for Unix and Linux like systems which synchronizes files and directories from one location to another while minimizing data transfer using delta encoding when appropriate.
** Always use rsync over ssh because rsync does not provide any security while transferring data.
rsync over ssh (with password)
rsync -avz ssh /home/user/ user@192.168.0.100:/backup/user/
To use a different ssh port, e.g., 123:
rsync -avz 'ssh -p 123' /home/user/ user@192.168.0.100:/backup/user/
The terminal will prompt for password before proceed.
To rsync without prompting for password, we can generate a ssh public key and add it to backup server’s ssh authorized keys. Below are the steps.