How to Use Rsync with Specific Port in Linux?

By Hardik Savani October 13, 2022 Category : Ubuntu

Hey Guys,

This tutorial will give you an example of how to use rsync with specific port in linux. We will use rsync specify port number. In this article, we will implement a rsync set port number ssh. I would like to share with you rsync specify port with ssh. Alright, let us dive into the details.

Sometimes, we need to download or upload data on server then we will use rsync for Linux server. But if when you connect to a server then you need to use ssh with a specific port then how you will do it? Yes, I will help you with it. You can also use the port number with Rsync ubuntu command.

So, let's see the solution below:

rsync without Port

rsync -avz /path/local/files root@:0.0.0.0:/path/on/my/server

rsync with Specific Port

We will add -p option to specify port number.

rsync -rvz -e 'ssh -p 18765' --progress /path/local/files/uploadZipFile.zip root@:0.0.0.0:/www/example.com/uploadZipFile -p 18765

/path/local/files: this is the path of local file that you want to upload on server.

root: this is a username of your linux server.

0.0.0.0: this is a ip address of your linux server.

/www/example.com/uploadZipFile: this is the path of server folder where you upload file on server.

-p: specify port number.

I hope it can help you...

Tags :
Shares