Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 14 down vote accepted

Try this:

rsync -ave 'ssh -p 456' /home/cavo/python/ wolfy@123.123.123.123:/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.

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

Your Answer

 
discard

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.