[转帖] rsync 完全配置
配置 rsync <br><br>
系统环境 <br>
<br>
# uname -a <br>
Linux linuxas3.9812.net 2.4.21-4.ELsmp #1 SMP Fri Oct 3 17:52:56 EDT 2003 i686 i686 i386 GNU/Linux <br><br>
<br>
安装rsync <br>
<br>
在AS3 第二张CD上找到rsync-2.5.6-20.i386.rpm <br>
<br>
# cd /mnt <br>
# mount cdrom <br>
# cd cdrom/RedHat/RPMS <br>
# rpm -ivh rsync-2.5.6-20.i386.rpm <br><br>
<br>
配置/etc/rsyncd.conf <br>
<br>
在rh9,as3系统上rsync安装后,并没有创建rsyncd.conf文档,笔者是自己创建的rsyncd.conf文档 <br>
<br>
# vi /etc/rsyncd.conf <br>
<br>
uid=nobody <br>
gid=nobody <br>
max connections=4 <br>
use chroot=no <br>
log file=/var/log/rsyncd.log <br>
pid file=/var/run/rsyncd.pid <br>
lock file=/var/run/rsyncd.lock <br>
#auth users=root <br>
secrets file=/etc/rsyncd.pwd <br>
<br>
<br>
path=/var/mail <br>
comment = backup mail <br>
ignore errors <br>
read only = yes <br>
list = no <br>
auth users = postfix <br>
<br>
<br>
path=/home/netkiller/web <br>
comment = backup 9812.net <br>
ignore errors <br>
read only = yes <br>
list = no <br>
auth users = netkiller <br>
<br>
<br>
path=/var/lib/pgsql <br>
comment = backup postgresql database <br>
ignore errors <br>
read only = yes <br>
list = no <br>
<br><br>
<br>
选择说明 <br>
<br>
uid = nobody <br>
gid = nobody <br>
use chroot = no # 不使用chroot <br>
max connections = 4 # 最大连接数为4 <br>
pid file = /var/run/rsyncd.pid #进程ID文件 <br>
lock file = /var/run/rsync.lock <br>
log file = /var/log/rsyncd.log # 日志记录文件 <br>
secrets file = /etc/rsyncd.pwd # 认证文件名,主要保存用户密码,权限建议设为600,所有者root <br>
<br>
# 这里是认证的模块名,在client端需要指定 <br>
path = /var/mail # 需要做镜像的目录 <br>
comment = backup xxxx # 注释 <br>
ignore errors # 可以忽略一些无关的IO错误 <br>
read only = yes # 只读 <br>
list = no # 不允许列文件 <br>
auth users = postfix # 认证的用户名,如果没有这行,则表明是匿名 <br>
<br>
<br>
path = /path/to... <br>
comment = xxxxx <br><br>
<br>
密码文件 <br>
<br>
在server端生成一个密码文件/etc/rsyncd.pwd <br>
<br>
# echo postfix:xxx >>/etc/rsyncd.pwd <br>
# echo netkiller:xxx >>/etc/rsyncd.pwd <br>
# chmod 600 /etc/rsyncd.pwd <br><br>
<br>
启动rsync daemon <br>
<br>
# rsync --daemon <br><br>
<br>
测试 <br>
<br>
# rsync rsync://www.9812.net/netkiller <br>
<br>
# rsync rsync://netkiller@www.9812.net/netkiller <br>
Password: <br>
<br>
$ rsync -vzrtopg --progress --delete postfix@www.9812.net::postfix /tmp <br>
Password: <br><br>
<br>
rsync rsync://认证用户@主机/模块 <br>
<br>
rsync -vzrtopg --progress --delete 认证用户@主机::模块 /mirror目录 <br>
<br>
添加到启动文件 <br>
<br>
echo "rsync --daemon" >> /etc/rc.d/rc.local<br>
<br>
<br>
页:
[1]