rsync配置文件 vim /etc/rsyncd.conf
非系统用户方式进行同步,此时不受ssh端口影响 ,无论ssh端口改成什么,都不受影响,因为没有使用ssh协议,使用的rsync协议,当使用系统用户的时候,才会使用ssh协议,此时必须
vim /etc/rsync.passwd
服务端要有用户名:密码 rsyncuser:password123
客户端要有密码 password123
客户端向服务端推rsync -avz /var/www/html/ [email protected]::wwwroot
客户端向服务端推,不用输入密码rsync -avz /var/www/html/ [email protected]::wwwroot --password-file=/etc/rsync.passwd
采用系统用户方式进行同步
客户端向服务端进行推送 ,-e “ssh -p指定端口号” ,服务端用户名rget1对/var/www/html有rwx权限
服务端 setfacl -R -m user:rget1:rwx /var/www/html #-R -m 是给目录下所有文件都设置权限
服务端 setfacl -R -m default:rget1:rwx /var/www/html
客户端 rsync -avz /var/www/html/ -e "ssh -p 22" [email protected]:/var/www/html