Two Way rsync via SSH: Difference between revisions
From D3xt3r01.tk
Jump to navigationJump to search
m Created page with '==WHY== Because I need to keep in sync some servers with the same content... ==HOW== 1) Password-less SSH Login 2) <source lang="bash"> rsync -e 'ssh -ax -p PORT -l USER…' |
mNo edit summary |
||
Line 12: | Line 12: | ||
rsync -e 'ssh -ax -p PORT -l USER -i /path/to/rsync-key' -avzurP /path/to/source/ REMOTE_HOST:/path/to/destination/ | rsync -e 'ssh -ax -p PORT -l USER -i /path/to/rsync-key' -avzurP /path/to/source/ REMOTE_HOST:/path/to/destination/ | ||
rsync -e 'ssh -ax -p PORT -l USER -i /path/to/rsync-key' -avzurP REMOTE_HOST:/path/to/destination/ /path/to/source/ | rsync -e 'ssh -ax -p PORT -l USER -i /path/to/rsync-key' -avzurP REMOTE_HOST:/path/to/destination/ /path/to/source/ | ||
</source> | |||
Another example would be trying to backup your '/overlay' partition from an openwrt box. Keep in mind you need rsync on the openwrt box too or you'll be greeted with this error: | |||
<source lang="bash"> | |||
ash: rsync: not found | |||
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver] | |||
rsync error: remote command not found (code 127) at io.c(605) [Receiver=3.0.9] | |||
</source> | |||
Here it is ... without the rsync-key | |||
<source lang="bash"> | |||
rsync -HDgopt -e 'ssh -ax -p PORT -l USER' -avzurP 192.168.1.1:/overlay/ /path/to/destination/ | |||
</source> | </source> |
Latest revision as of 11:50, 16 December 2012
WHY
Because I need to keep in sync some servers with the same content...
HOW
2)
rsync -e 'ssh -ax -p PORT -l USER -i /path/to/rsync-key' -avzurP /path/to/source/ REMOTE_HOST:/path/to/destination/
rsync -e 'ssh -ax -p PORT -l USER -i /path/to/rsync-key' -avzurP REMOTE_HOST:/path/to/destination/ /path/to/source/
Another example would be trying to backup your '/overlay' partition from an openwrt box. Keep in mind you need rsync on the openwrt box too or you'll be greeted with this error:
ash: rsync: not found
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: remote command not found (code 127) at io.c(605) [Receiver=3.0.9]
Here it is ... without the rsync-key
rsync -HDgopt -e 'ssh -ax -p PORT -l USER' -avzurP 192.168.1.1:/overlay/ /path/to/destination/