rsync配置安装

rsync安装

1.将rsync包解压,包链接: https://pan.baidu.com/s/1jHPosXC 密码: maay
2.进入rsync安装包运行命令:
./configure --prefix=/usr
make
make install

3.进入/etc目录创建rsync目录
mkdir rsync
4.进入/etc/rsync目录创建3个配置文件
rsyncd.conf    //配置文件
rsyncd.pas     //密码文件
rsyncd.motd    //说明文件

5.rsyncd.conf配置文件选项:
log file = /usr/local/rsync/var/rsyncd.log
pid file = /usr/local/rsync/var/rsyncd.pid
lock file = /usr/local//etc/rsyncd.lock
secrets file = /etc/rsync/rsyncd.pas   //密码文件
motd file = /etc/rsync/rsyncd.motd     //欢迎语
port = 873    //端口号
read only = no
hosts allow = 000.000.000.000 000.000.000.000     //允许同步的ip地址,多个用空格相隔
list = yes
uid = nobody
gid = nobody
use chroot = no
max connections = 4
exclude = /bak/not            //要忽略的文件目录
[bak]                         //模块名
path = /home/bak              //需要同步的文件目录
comment = www bak             //注解
auth users = test             //用户名

5.创建rsyncd.pas
test:123456      //用户名:密码


6.创建rsyncd.motd

++++++++++++++++++++++++++++++++++++++++++++++++++
+                    welcome                     +
++++++++++++++++++++++++++++++++++++++++++++++++++


客户端安装rsync可相同步骤


启动rsync:   /usr/bin/rsync --daemon  --config=/etc/rsyncd.conf


同步命令: rsync -av /home/bak test@000.000.000.000::bak
运行此命令后,会提示输入密码,密码为不可见状态,输入完成按回车


同步命令2:rsync -av /home/bak test@000.000.000.000::bak --password-file=/etc/rsync/auth.pas
此命令可省去输入密码步骤,在/etc/rsync/下新建auth.pas文件,将rsyncd.pss用户密码输入123456,只需要输入密码XXXX,保存

上面创建的所有密码文件都需要600权限
chown root.root rsyncd.pas/auth.pas
chmod 600 rsyncd.pas/auth.pas


开启端口873
iptables -I INPUT -p tcp --dport 873-j ACCEPT


如果提示failed to create pid file /usr/local/rsync/var/rsyncd.pid: No such file or directory
进入/usr/local目录创建rsync/var目录

  

posted on 2017-09-14 17:19  diguaer  阅读(281)  评论(0编辑  收藏  举报

导航