• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

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

991

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

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.

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

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

rsync Command in Linux with Examples
rsync Command in Linux with Examples
Mar 22, 2016
How to use Rsync- To Sync Two Apache Web Servers
How to use Rsync- To Sync Two Apache Web Servers
May 28, 2016
How to Sync Files/Directories Using Rsync with Non-standard SSH Port
How to Sync Files/Directories Using Rsync with Non-standard SSH Port
Jun 8, 2016

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

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

Rsync
isaac class=
How to fix corrupt packet error for with rsync for (relatively) large files
Nov 19, 2018
Rsync
jacob class=
Rsync: failed to set permissions on..
Oct 22, 2021
CentOS
samson class=
rsync: Failed to exec ssh: No such file or directory (2)
Oct 21, 2017
Ubuntu
mason class=
Backup files with rsync: error 23
Feb 25, 2021
Rsync
nicholas class=
Removing source files after send to destination in Linux
Feb 9, 2017
Rsync
rio class=
How to transfer multiple file in single command
Feb 17, 2017
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 Luk Van De Looverbosch ?
How to create a root ?

Hello,
How to create root@linuxhelp in Linux Mint 20.1 64-bit ?
Thanks in advance for your reply.
Best regards.

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.