Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let say that I have 2 machines:

  • local (centos)
  • remote on IP: 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?

share|improve this question
up vote 16 down vote accepted

Try this:

rsync -ave 'ssh -p 456' /home/cavo/python/ wolfy@ 

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.

share|improve this answer
works perfectly :) thanks for a detailed explain! – Wolfy Aug 2 '11 at 8:31
Trailing slash is only important on the source, not on destination. – enzotib Aug 2 '11 at 9:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.