A往B推送文件,B开启rsync服务即可
B端操作
vi /etc/rsyncd.conf
secrets file = /etc/rsync.pass
hosts allow = 192.168.72.32
auth users = rsync
uid = root
gid = root
read only = false
use chroot = yes
auth users = rsync
max connections = 4
pid file = /var/run/rsyncd.pid
log file = /var/log/rsyncd.log
transfer logging = yes
timeout = 900
ignore nonreadable = yes
dont compress = *.gz *.tgz *.zip *.z *.Z *.rpm *.deb *.bz2
[zhsq-dp]
path = /data/rsync-file/zhsq-dp
配置账号密码,对应用户名和密码
cat /etc/rsync.pass
rsync:123456
将rsync.pass权限设置为600
chmod 600 /etc/rsync.pass
开启服务
systemctl start rsyncd
systemctl enable rsyncd
A端操作
cat /etc/rsync.pass
123456
更改文件权限
chmod 600 /etc/rsync.pass
A通过rsync将文件传到B示例
rsync -avzt dist.tar.gz [email protected]::zhsq-web --password-file=/etc/rsync.pass
rsync:rsync密码文件内的账号
::zhsq-web:配置文件里配置的目录名称