建站服務(wù)器
1.1.1 rsync安裝
服務(wù)端與客戶(hù)端都需要安裝 rsync
安裝命令:
yum install rsync
1.1.2 rsync 服務(wù)端配置步驟 1:生成并編輯配置文件rsyncd.conf
#touch /etc/rsyncd.conf #生成rsync的配置文件
#vi /etc/rsyncd.conf
具體內(nèi)容如下所示(需要手動(dòng)輸入):
secrets file = /etc/rsyncd.secrets
read only = yes
list = yes
uid = root
gid = root
hosts allow = 10.3.4.219 #客戶(hù)端IP地址,多個(gè)以空格分開(kāi)
#hosts deny = 10.4.5.0/24
use chroot = no
max connections = 10
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
charset=GBK
[rsyncd]
comment = pag's directory #自己添加說(shuō)明
path = /home/test #要同步的目錄
auth users = rsync #使用的用戶(hù)
secrets file = /etc/rsyncd.secrets
步驟 2:生成驗(yàn)證文件
# echo "rsync:rsync" > /etc/rsyncd.secrets ( rsync:rsync為用戶(hù)和密碼,格式為user:passwd)
# chown root:root /etc/rsyncd.secrets