RSYNC配置

1.编辑rsync配置文件
vim /etc/rsyncd.conf
uid = nobody
gid = nobody
use chroot = no
max connections = 10
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsyncd.lock
log file = /var/log/rsyncd.log
motd file = /etc/rsyncd.motd
hosts allow = 127.0.0.1 192.168.0.0/255.255.255.0
auth users = rsyncuser
secrets file = /etc/rsyncd.secrets
[rsync]
path = /rsync
comment = ServerHome
read only = true
list =false
uid、gid必须是内建用户,这里用nobody帐号作为最小权限。
auth users是虚拟用户,有多个的话用逗号隔开。
2.建立rsync目录
mkdir /rsync
chown nobody. /rsync
3.定义服务器信息文件
echo "rsyncserver for test" > /etc/rsyncd.motd
4.定义密码文件
echo "rsyncuser:test" > /etc/rsyncd.secrets
test是密码,不支持加密
5.设置目录权限
chmod 600 /etc/rsyncd.conf 
chmod 600 /etc/rsyncd.motd 
chmod 600 /etc/rsyncd.secrets 
6.重启服务
service xinetd restart

客户端测试
建立密码文件
echo "test" > /root/secrets
chmod 600 /root/secrets
测试
rsync -Rav --delete --password-file=/root/secrets [email protected]::rsync /tmp

你可能感兴趣的:(职场,rsync,休闲)