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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章