Rsync over ssh with custom port

It’s just a quick tip. How can you force rsync to use a specific port when connecting to remote machine via ssh? Turns out it’s pretty easy, if you dig into man page deep enough. Simply specify needed port in ‘-e’ option like this:

rsync -av -e "ssh -p 123" example.com:/path/on/remote/server ~/local/path

As a bonus, with the same option you can add a lot more useful options, like compression and compression ratio:

... -e "ssh -p 123 -C -oCompressionLevel=9" ...

Advertisements

~ by Tener on 14/11/2009.

3 Responses to “Rsync over ssh with custom port”

  1. […] mostly code :bash, linux, rsync No comments for this entry yet… […]

  2. Thanks for the tip 🙂 saved me some searching.

  3. thanks for the tip.. was searching for quite some time ..

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: