port=873
log file=/var/log/rsync.log
pid file=/var/run/rsyncd.pid
address=192.168.21.128
[test]
path=/tmp/rsync
use chroot=true
max connections=4
read only=no
list=true
uid=root
gid=root
auth users=test
secrets file=/etc/rsyncd.passwd
hosts allow=192.168.21.129 1.1.1.1 2.2.2.2 192.168.21.0/24
[root@akuilinux01 ~]# vim /etc/rsyncd.conf
[root@akuilinux01 ~]# mkdir /tmp/rsync
[root@akuilinux01 ~]# chmod 777 /tmp/rsync/
[root@akuilinux01 ~]# rsync --daemon
[root@akuilinux01 ~]# ps aux |grep rsync
root 3408 1.6 0.0 114696 540 ? Ss 22:02 0:00 rsync --daemon
root 3410 0.0 0.0 112676 980 pts/0 S+ 22:02 0:00 grep --color=auto rsync
[root@akuilinux01 ~]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 880/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1080/master
tcp 0 0 192.168.21.128:873 0.0.0.0:* LISTEN 3408/rsync
tcp6 0 0 :::22 :::* LISTEN 880/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1080/master
[root@akuilinux02 ~]# rsync -avP /tmp/1.txt 192.168.21.128::test/aming02.txt
Password:
@ERROR: auth failed on module test
rsync error: error starting client-server protocol (code 5) at main.c(1648) [sender=3.1.2]
[root@akuilinux01 ~]# vim /etc/rsyncd.conf
gid=root
#auth users=test
#secrets file=/etc/rsyncd.passwd
hosts allow=192.168.21.129 1.1.1.1 2.2.2.2 192.168.21.0/24
[root@akuilinux01 ~]# killall rsync
[root@akuilinux01 ~]# ps aux |grep rsync
root 3642 0.0 0.0 112676 980 pts/0 S+ 22:53 0:00 grep --color=auto rsync
[root@akuilinux01 ~]# rsync --daemon
[root@akuilinux01 ~]# !ps
ps aux |grep rsync
root 3645 0.8 0.0 114696 540 ? Ss 22:54 0:00 rsync --daemon
root 3647 0.0 0.0 112676 980 pts/0 S+ 22:54 0:00 grep --color=auto rsync
[root@akuilinux01 ~]# !net
netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 880/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1080/master
tcp 0 0 192.168.21.128:8730 0.0.0.0:* LISTEN 3645/rsync
tcp6 0 0 :::22 :::* LISTEN 880/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1080/master
[root@akuilinux02 ~]# rsync -avP --port 8730 /tmp/1.txt 192.168.21.128::test/aming02.txt
sending incremental file list
sent 44 bytes received 12 bytes 112.00 bytes/sec
total size is 846 speedup is 15.11
root@akuilinux02 ~]# ls /var/log/messages*
/var/log/messages /var/log/messages-20180313 /var/log/messages-20180328 /var/log/messages-20180512
原文地址:http://blog.51cto.com/akui2521/2116768