服务器端:(10.0.0.158)
1. 确认安装 rsync
2. 建立并配置 /etc/rsyncd.conf
secrets file = /etc/rsyncd.pwd
motd file = /etc/rsync.motd
read only = yes
list = yes
uid = nobody
gid = nobody
hosts allow = 10.0.0.126
hosts deny = 0.0.0.0/0
max connections = 4
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
[TEST]
comment =
path = /source/test
auth users = user_test
[Share]
comment =
path = /source/share
auth users = user_admin
3.建立密码文件 /etc/rsyncd.pwd
指定用户密码
echo user_test:password >> /etc/rsyncd.pwd
修改文件属性: chmod 600 /etc/rsyncd.pwd
4.启动rsync服务
[root@DB_Backup log]# rsync --daemon
检查服务,端口为873
[root@DB_Backup log]# netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:873 0.0.0.0:* LISTEN 26827/rsync
客户端(10.0.0.126):
1. 建立密码文件 /etc/rsync.pwd
输入对应密码: echo password >> /etc/rsync.pwd
修改文件属性: chmod 600 /etc/rsync.pwd
2. 同步文件:
rsync -vazu --progress --password-file=/etc/rsync.pwd
阅读(910) | 评论(0) | 转发(0) |