rsync配置

您所在的位置:网站首页 真诚纯朴的朋友的古文词语 rsync配置

rsync配置

2023-03-11 16:12| 来源: 网络整理| 查看: 265

# rpm -qa |grep rsync #检查系统是否安装了rsync软件包 rsync-2.6.8-3.1

#yum install rsync

服务器-----------------------------------------

1 配置rsync servervi /etc/xinetd.d/rsync

将disable=yes改为no service rsync { disable = no socket_type = stream wait = no user = root server = /usr/bin/rsync server_args = --daemon log_on_failure += USERID

}

2 配置rsync自动启动 [root@test etc]# chkconfig rsync on [root@test etc]# chkconfig rsync --list rsync on

3 配置rsyncd.conf

rsyncd.conf 没有需要自己创建,最好所有文件放在一个目录下

mkdir /etc/rsyncd

touch rsyncd.conf

ln -s /etc/rsyncd/rsyncd.conf /etc/rsyncd.conf

[root@test etc]# vim rsyncd.conf  uid=root gid=root use chroot=no max cOnnections=4 port=873

pid file=/var/run/rsyncd.pid lock file=/var/run/rsync.lock log file=/var/log/rsyncd.log motd file=/etc/rsyncd.motd

hosts allow=127.0.0.1 10.47.122.0/255.255.255.0 10.24.234.0/255.255.255.0

[test] path=/usr/local/src/test comment=ServerTest read Only=on list=yes #auth users=test #secrets file=/etc/rsyncd/rsyncd.pas

4 确保etc/services中rsync端口号正确 [root@test etc]# vim /etc/services rsync 873/tcp # rsync rsync 873/udp # rsync 5 配置rsync密码(在上边的配置文件中已经写好路径)/home/rsync.ps(名字随便写,只要和上边配置文件里的一致即可),格式(一行一个用户) [root@test etc]# vi /etc/rsyncd/rsyncd.pas  test:test 6 配置rsync密码文件权限 [root@test home]# chown root.root rsyncd.pas [root@test home]# chmod 600 rsyncd.pas

7 首次启动配置

rsync –-daemon –-cOnfig=/etc/rsyncd.conf

failed to create pid file /var/run/rsyncd.pid: File exists  [root@www ~]# rm -rf /var/run/rsyncd.pid  [root@www ~]# rsync –daemon –cOnfig=/etc/rsyncd.conf

如果没有出现创建pid错误,就不需要删除pid文件再启动。

确认rsync是否启动了?

[root@www ~]# ps -ef | grep rsync  root     29768     1  0 15:19 ?        00:00:00 rsync –daemon –cOnfig=/etc/rsyncd.conf  root     29792 28996  0 15:21 pts/0    00:00:00 grep rsync

客户端配置 1 配置三个过程就可以了 1.1 设定密码文件 1.2 测试rsync执行指令

[root@aj1 home]# vi /etc/xinetd.d/rsync  # default: off # description: The rsync server is a good addition to an ftp server, as it \ # allows crc checksumming etc. service rsync { disable = yes socket_type = stream wait = no user = root server = /usr/bin/rsync server_args = --daemon log_on_failure += USERID } 1.1 配置密码文件 (注:为了安全,设定密码档案的属性为:600。rsync.ps的密码一定要和Rsync Server密码设定案里的密码一样) [root@aj1 home]# vi /etc/rsyncd/rsyncd.pas  sciooo [root@aj1 home]# chown root.root .rsyncd.pas # 注意必须给权限 [root@aj1 home]# chmod 600 .rsyncd.pas # 必须修改权限 1.2 从服务器上下载文件 [root@aj1 rsync-3.0.4]# rsync -avz --password-file=/etc/rsyncd/rsyncd.pas [email protected]::test /home/ 从本地上传到服务器上去 [root@aj1 rsync-3.0.4]# rsync -avz --password-file=/etc/rsyncd/rsyncd.pas  /home/ [email protected]::test

rsync 配置



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3