How to configure rsysnc in daemon mode (allow rsync and disable SSH login) in CentOS/RHEL?

To allow rsync and disable ssh by configuring rsync in daemon mode. In order to achieve this below steps can be performed.

 

1. Configure rsync in daemon mode in server. For this we need to first modify file /etc/rsyncd.conf, the following is an example:

# vi /etc/rsyncd.conf# vi /etc/rsyncd.conf
motd file = /etc/rsyncd.motd
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock

[module_name]
path = /rsync_directory
comment = My Very Own Rsync Server
uid = nobody
gid = nobody
read only = no
hosts allow = ip address or domain address
hosts deny = * 

 

2. Run rsync in daemon mode using the below command.

# rsync --daemon

 

3. Specify the module name when using rsync command on Client machine.

# rsync -avRX rsync_server_ip::module_name /rsync_directory -v

 

4. Configure the user with nologin shell on server. eg: This will prevent test user to disable ssh login.

# cat /etc/passwd | grep test
test:x:500:500::/home/test:/sbin/nologin 

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)