Command for rsync for ssh running on non-default port no 22

Rsync is great unix tool to sync files between systems. It has inbuilt compression much needed for reducing network load, transfers in acrhieve mode so that permission are preserved. However, the best feature of rsync is that it transfers in delta mode. That is, compares remote and local files, and only transfers the files that are changes ! Awesome and cool for many years.

However, due to security reasons I ran my ssh server on a remote system at a non standard port. Since port 22 is constantly bombarded with login attempts, it is a great security strategy to use a non default port.

The command to run for rsync to work in such condition is :

# for ssh server running on remote server at port 9200 
rsync -avz -e 'ssh -p 9200' user@remote_server:/src /dest

For a simple login use -p option

ssh -p 9200 user@remote_server

Scp uses a capital “P”

scp -P 9200 /src_dir/ user@remote_server:/dest

Comments and discussions warmly accepted.



One thought on “Command for rsync for ssh running on non-default port no 22

Leave a Reply

Your email address will not be published. Required fields are marked *