1.服务端:
安装:
[root@localhost ~]# yum -y install rsync
创建配置文件:
[root@localhost ~]# vim /etc/rsyncd.conf(手动建立配置文件)
uid = user
gid = user(此处关键,与后边ip漂移后断点续传相关)
use chroot = yes
address = 192.168.10.101
port 873
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
hosts allow = 192.168.10.0/24
[ftproot](共享模块名)
path = /home/sprixin1/(最后必须带反撇)
comment = ftp export area
read only = no
dont compress = *.gz *.bz2 *.tgz *.zip *.rar *.z
auth users = user(认证用户名)
secrets file = /etc/rsyncd_users.db(认证密码文件)
创建认证密码文件:
[root@localhost ~]# echo "user:123456" > /etc/rsyncd_users.db
[root@localhost ~]# chmod 600 /etc/rsyncd_users.db
[root@localhost ~]# chmod -R 777 /home/user/(修改发布目录的权限)(原来755)
启动服务:
[root@localhost ~]# rsync --daemon
[root@localhost ~]# ss -anpt|grep 873
2.客户端:
安装rsync:
[root@localhost ~]# yum -y install rsync
客户端测试:
[root@localhost sprixin1]# rsync -avz user@192.168.10.102::ftproot /home/user/
补充:免交互设置
[root@localhost ~]# echo “123456” > /etc/server.pass
[root@localhost ~]# chmod 600 /etc/server.pass
[root@localhost ~]# rsync -avz --password-file=/etc/server.pass user@192.168.10.102::ftproot /home/user/
来源:CSDN
作者:灬紫荆灬
链接:https://blog.csdn.net/weixin_43279032/article/details/103592897