rsync配置推送文件

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 rsync@192.168.201.69::zhsq-web --password-file=/etc/rsync.pass

rsync:rsync密码文件内的账号
::zhsq-web:配置文件里配置的目录名称

posted @ 2024-01-31 16:45  开心burukku  阅读(38)  评论(0编辑  收藏  举报