rsync 本端 server 配置,先生成一个虚拟用户 rsyncuser和密码 rsyncpassword:
echo "rsyncuser:rsyncpassword" > /etc/rsync.password
文件权限一定要做:
chmod 600 /etc/rsync.password
rsync 的服务器端的配置文件:
# cat /etc/rsyncd.conf
read only = false
uid = root
gid = root
auth users = rsyncuser
secrets file = /etc/rsync.password
hosts allow = *
[all]
path = /xxx/yyy/zzz
服务器端启动rsync服务就可以了。rsync --daemon
rsync 的客户端的配置:
也是一样,先配置密码文件(只需要放密码就可以了):
echo "rsyncpassword" > /etc/rsync.password
文件权限一定要做:
chmod 600 /etc/rsync.password
以下命令就可以直接用了:
/usr/bin/rsync -avzP --password-file=/etc/rsync.password /aaa/bbb/ccc rsyncuser@1.2.3.4::all/