"rsync" from remote to local
Let say that I have 2 machines:
- local (centos)
- remote on IP: 123.123.123.123 ssh port 456 (ubuntu server)
and I want to synchronize my remote folder /home/wolfy/py
with my local folder /home/cavo/python
.
Can this be done with rsync
? Can you give me an example?
Try this:
rsync -ave 'ssh -p 456' /home/cavo/python/ [email protected]:/home/wolfy/py/
Note that the trailing slashes on the paths are very important, they signal that you are syncing a directory to a directory. The -e
switch helps rsync
know it is going to be using ssh
transport, and while we are specifying the transport we also tell ssh what port it's going to have to use to talk to the remote site. Then the username and remote host ip are specified as part of the target.