实例:从服务器 A 将目录 /home/someone/sth 上的内容,传输到服务器 B 的 /home/someone/upload
=== 服务器 B 上 rsyncd
的设置 ===
1. 设置 rsyncd.conf
$ pwd
/home/someone/rsyncd
$
cat rsyncd.conf
uid = nobody
gid = nobody
use chroot = no
max
connections = 4
pid file = /home/someone/rsyncd/run/rsyncd.pid
lock
file = /home/someone/rsyncd/run/rsync.lock
log file =
/home/someone/rsyncd/log/rsyncd.log
secrets file =
/home/someone/rsyncd/rsyncd.pwd
[tagname]
path = /home/someone/upload
read only =
false
write only = true
list = false
auth users = test
2. 创建 rsyncd.pwd
$ echo
"test:testpwd" > rsyncd.pwd
$ chmod 600 rsyncd.pwd
3. 启动 rsyncd
rsync -4 --verbose
--daemon --port=8730 --config=/home/someone/rsyncd/rsyncd.conf
=== 服务器 A ===
1. 创建 test.pwd
$ pwd
/home/someone
$
echo "testpwd" > test.pwd # 注意这里, 并不需要 user, 只需要 passwd 信息即可
$
chmod 600 test.pwd
2. 传输数据
$ rsync --recursive
--password-file=/home/someone/test.pwd --port=8730 /home/test/sth
test@server_B_ip::tagname
~~~~~~~~~~~~~`
如此这般,就可在服务器B
/home/someone/upload/sth 这里找到所有内容啦。
阅读(694) | 评论(0) | 转发(0) |