• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to Sync Files/Directories Using Rsync with Non-standard SSH Port

{{postValue.id}}

Synchronization of Directories/Files with the help of Rsync with Non-standard SSH Port

rsync is a versatile, fast and powerful tool, which is used to sync and copy directories/files from local to remote or from remote to local hosts and vice-versa. Methods of Synchronizing files using rsync with non-standard SSH port are explained in this tutorial.

Modification of SSH Port to Non-standard Port

Open and edit the SSH configuration /etc/ssh/sshd_config file

[root@linuxhelp ~]# vim /etc/ssh/sshd_config 


Uncomment and modify the port number. Here, we are changing the port number 22 to 15845.

[...]
Port 15845
[...]


Save the file and close it.

Now you have to allow the new port through your router or firewall.

[root@linuxhelp ~]# firewall-cmd --permanent --add-port=15845/tcp
success
[root@linuxhelp ~]# firewall-cmd --reload 
Success


You have to upgrade selinux permissions to allow the port.

[root@linuxhelp ~]# semanage port -a -t ssh_port_t -p tcp 15845


Now restart SSH service

On SystemD

[root@linuxhelp ~]# systemctl restart sshd 


On SysVinit

[root@linuxhelp ~]# service sshd restart 


Synchronization of Rsync with non-standard SSH Port

Inorder to sync directories/files with the help of Rsync with non-standard ssh port, you have to execute the below command from the terminal.

SYNTAX:

# rsync -arvz -e ' ssh -p '  user@remote-server:/path/to/remote/folder /path/to/local/folder


Details of Remote System:

IP Address: 192.168.5.88
User name: root
Sync folder: /root/files

Details of Local System:

IP Address: 192.168.5.89
Sync folder: /root/backup

Synchronizing the contents of /root/files directories from remote server to /root/backup/ of my local system.

[root@linuxhelp ~]# rsync -arvz -e ' ssh -p 15845'  root@192.168.5.88:/root/files /root/backup/
The authenticity of host ' [192.168.5.88]:15845 ([192.168.5.88]:15845)'  can' t be established.
ECDSA key fingerprint is 03:b1:88:9e:3d:c6:eb:fe:38:6c:3f:90:06:51:4b:c9.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ' [192.168.5.88]:15845'  (ECDSA) to the list of known hosts.
root@192.168.5.88' s password: 
receiving incremental file list
files/
files/1
files/10
files/2
files/3
files/4
files/5
files/6
files/7
files/8
files/9

sent 205 bytes  received 482 bytes  50.89 bytes/sec
total size is 0  speedup is 0.00


To verify the transferred files

[root@linuxhelp ~]# ls -l backup/files/
[root@linuxhelp ~]# cd backup
[root@linuxhelp ~]# ls -l files
total 0
-rw-r--r--. 1 root root 0 May 28 11:43 1
-rw-r--r--. 1 root root 0 May 28 11:43 10
-rw-r--r--. 1 root root 0 May 28 11:43 2
-rw-r--r--. 1 root root 0 May 28 11:43 3
-rw-r--r--. 1 root root 0 May 28 11:43 4
-rw-r--r--. 1 root root 0 May 28 11:43 5
-rw-r--r--. 1 root root 0 May 28 11:43 6
-rw-r--r--. 1 root root 0 May 28 11:43 7
-rw-r--r--. 1 root root 0 May 28 11:43 8
-rw-r--r--. 1 root root 0 May 28 11:43 9


Check the manual page to get more details about rsync command in linux.

[root@linuxhelp ~]# man rsync

Tags:
connor
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

what is purpose of -R in rsync

A

R, --relative use relative path names. It save the destination as same path as source

Q

command not found error

A

install rsync "yum install rsync"

Q

how to get a source location from a file

A

rsync -Pavzxl --files-from=/path/to/files.txt / /destination/path/

Q

What is Freefilesync?

A

*FreeFileSync is used for comparing or synchronizing the folders and files on the multiple storage devices.

*This is very effective while taking backups manually and stores the resultant in two or more location.

Q

Are there limitations on the number of files to sync?

A

FreeFileSync imposes no artificial limitations on how many files you can sync. Practically speaking, the only limiting factor for extremely large sync jobs is the amount of free memory available: For each 1 GB of RAM, FreeFileSync can synchronize roughly 1.7 million file pairs at a time.

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Ryan ?
how to use visual traceroute tool

Am using traceroute command to check for the route. i got this tool while surfing. So pls help me out installation and usage of Visual traceroute tool.

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.