How To Use Rsync With Specific Port In Linux?

In this quick tip, I will show you an example of how to use rsync with specific port in linux. We will use rsync specify port number in linux. In this tutorial, I will show you how to implement a rsync set port number ssh. I wanna share with you rsync to specify the port with ssh.

Assume, we need to download or upload data on the server then we need to use rsync for the Linux server. But if when we connect to a server then we need to use ssh with a specific port then how you will do it? So, let's see the example command:

 

rsync without Port

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

 

rsync with Specific Port

We will add the -p option to specify the 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

 

In this above command:

  • /path/local/files: this is the path of the local file that you want to upload on the server.
  • root: this is the username of your Linux server.
  • 0.0.0.0: This is the IP address of your Linux server.

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

  • -p: specify the port number.

 

Read also: How Install Nginx on Ubuntu 20.04 LTS

 

Hope it can help you.

 

#linux