1.http://rsync.samba.org/ 找到合适版本进行下载
2.解压,进入rsync目录
3../configure --prefix=/usr/local/rsync
4.make && make install
5.ln -s /usr/local/rsync/bin/rsync /usr/local/bin/rsync
6.配置server:
(1)vi /usr/local/rsync/rsyncd.conf
pid file = /var/run/rsyncd.pid
port = 873
pid = root
gid = root
use chroot = no
max connections = 200
timeout 600
lock file = /var/run/rsyncd.lock
log file = /var/run/rsyncd.log
secrets file = /usr/local/rsync/rsyncd.secrets
motd file = /etc/rsyncd.motd
[test]
path = /test/
ignore errors
read only = true
list = false
hosts allow = *
#hosts deny = 0.0.0.0/32
auth users root #该用户系统中存在且对后面指定的备份目录拥有权限
comment = ocpyang test
(2)
vi /usr/local/rsync/rsyncd.motd
++++++++++++++++++++++++++++++++++++
Wlecome to ocpyang rsync services
++++++++++++++++++++++++++++++++++++
(3)
vi /usr/local/rsync/rsyncd.secrets
root:snow01
(4)
ln -s /usr/local/rsync/rsyncd.conf /etc/rsyncd.conf
ln -s /usr/local/rsync/rsyncd.motd /etc/rsyncd.motd
ln -s /usr/local/rsync/rsyncd.secrets /etc/rsyncd.secrets
(5)
chmod 600 /usr/local/rsync/rsyncd.secrets
chown root:root /usr/local/rsync/rsyncd.secrets
(6)
启动:/usr/bin/rsync --daemon --config=/etc/rsyncd.conf
(7)
echo "/usr/bin/rsync --daemon --config=/etc/rsyncd.conf" >> /etc/rc.d/rc.local
(8)查看启动情况:
netstat -lntp | grep 873
7.客户端
(1).新建客户端密码文件(客户端不带用户名)
#vi /etc/rsyncd.secrets
snow01
#chmod 600 /etc/rsyncd.secrets
rsync -vzrtopg --progress --delete root@192.168.5.189::test /ocpyang/
rsync -vzrtopg --progress --delete root@192.168.5.189::test /ocpyang/ --password-file=/etc/rsyncd.pwd
区块链、后端技术交流!