Skip to content

rsync through SSH

rsync through SSH published on

If you want to RSYNC through SSH and there are probably a lot of data, then use following steps:

Install screen, so you can exit your SSH session during rsyncing.

Open scren:

screen

Start a rsync from remote to your local dir:

rsync -av -e ssh username@ipadressordns:/remote/his/folder /home/my/folder/ > rsync.log 2>&1

after you started this, use CTRL+Z and with the command `bg` you make sure, the command is running in the background.
now you can use tail, to stalk the progress of the sync

tail -f rsync.log

you can leave the screen with CTRL+A then D and you can exit the SSH connection and go having a beer.
The next day you can look at your syncing with:

# resume screen from day before
screen -r

# put sync command in foreground (if it is still running)
fg

# check sync file
vim rsync.log

# start another sync like above, to make sure, everything was synced correctly

helpful: <a href="http://troy.jdmz.net/rsync/index.html">http://troy.jdmz.net/rsync/index.html</a>;

Rsync with Sudo on Remote

rsync -av -e "ssh" --rsync-path="sudo rsync" /source/ user@server.com:/destination/