Home     About Us     RSSRSS

Posts Tagged ‘rsync with custom ssh port’

How to rsync with custom SSH Port

January 22, 2013 by @HKw@! | No Comments | Filed in centos, Debian, Fedora, Linux, Mac OS X, RedHat, Ubuntu

rsync is a great utility used to synchronize the files and directories from one location to another in an effective way. Normally i use rsync command to transfer files from my Mac OS X Machine to my Linux Server. Recently i change all my Linux Server SSH port from default port 22 to port 2424. When i try to transfer files from my local machine to my linux machine via rsync, it failed. By default, rsync command won’t work with custom SSH port as it assume the SSH port is set to 22.

After i read through the man page of rsync command, i found a solution on how to rsync file to a custom SSH port machine.

The solution is simple by add the -e flag. This flag allows you manually define the ssh command to use when connecting


rsync -avz -e “ssh -p $sshPortNo” user@remoteIP:/path/to/files/ /local/path/


rsync -avz -e “ssh -p 2424″ techkaki@ /Users/techkaki/Downloads/

Done!! :-)


Tags: ,