当前位置:操作系统 > Unix/Linux >>

rsync完全配置

配置 rsync

  系统环境

  [root@linuxas3 root]# uname -a

  Linux linuxas3.9812.net 2.4.21-4.ELsmp #1 SMP Fri Oct 3 17:52:56 EDT 2003 i686 i686 i386 GNU/Linux

  安装rsync

  在AS3 第二张CD上找到rsync-2.5.6-20.i386.rpm

  [root@linuxas3 root]# cd /mnt

  [root@linuxas3 mnt]# mount cdrom

  [root@linuxas3 mnt]# cd cdrom/RedHat/RPMS

  [root@linuxas3 RPMS]# rpm -ivh rsync-2.5.6-20.i386.rpm

  配置/etc/rsyncd.conf

  在rh9,as3系统上rsync安装后,并没有创建rsyncd.conf文档,笔者是自己创建的rsyncd.conf文档

  [root@linuxas3 root]# vi /etc/rsyncd.conf

  uid=nobody

  gid=nobody

  max connections=4

  use chroot=no

  log file=/var/log/rsyncd.log

  pid file=/var/run/rsyncd.pid

  lock file=/var/run/rsyncd.lock

  #auth users=root

  secrets file=/etc/rsyncd.pwd

  [postfix]

  path=/var/mail

  comment = backup mail

  ignore errors

  read only = yes

  list = no

  auth users = postfix

  [netkiller]

  path=/home/netkiller/web

  comment = backup 9812.net

  ignore errors

  read only = yes

  list = no

  auth users = netkiller

  [pgsqldb]

  path=/var/lib/pgsql

  comment = backup postgresql database

  ignore errors

  read only = yes

  list = no

  选择说明

  uid = nobody

  gid = nobody

  use chroot = no # 不使用chroot

  max connections = 4 # 最大连接数为4

  pid file = /var/run/rsyncd.pid #进程ID文件

  lock file = /var/run/rsync.lock

  log file = /var/log/rsyncd.log # 日志记录文件

  secrets file = /etc/rsyncd.pwd # 认证文件名,主要保存用户密码,权限建议设为600,所有者root

  [module] # 这里是认证的模块名,在client端需要指定

  path = /var/mail # 需要做镜像的目录

  comment = backup xxxx # 注释

  ignore errors # 可以忽略一些无关的IO错误

  read only = yes # 只读

  list = no # 不允许列文件

  auth users = postfix # 认证的用户名,如果没有这行,则表明是匿名

  [other]

  path = /path/to...

  comment = xxxxx

  密码文件

  在server端生成一个密码文件/etc/rsyncd.pwd

  [root@linuxas3 root]# echo postfix:xxx >>/etc/rsyncd.pwd

  [root@linuxas3 root]# echo netkiller:xxx >>/etc/rsyncd.pwd

  [root@linuxas3 root]# chmod 600 /etc/rsyncd.pwd

  启动rsync daemon

  [root@linuxas3 root]# rsync --daemon

  测试

  [root@linux docbook]# rsync rsync://www.9812.net/netkiller

  [root@linux tmp]# rsync rsync://netkiller@www.9812.net/netkiller

  Password:

  [chen@linux temp]$ rsync -vzrtopg --progress --delete postfix@www.9812.net::postfix /tmp

  Password:

  rsync rsync://认证用户@主机/模块

  rsync -vzrtopg --progress --delete 认证用户@主机::模块 /mirror目录

  添加到启动文件

  echo

  "rsync

  --daemon"

  >>

  /etc/rc.d/rc.local

  完成本文来自:http://www.xiaoyaxiao.com/1912.html
发表您的高见!
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,