centos6 64X rsync 使用实战
2015-12-03 13:50
731 查看
centos rsync 使用实战
场景: 搭建服务同步源,客户端拉取同步文件
服务端(191.168.1.100)
客户端(191.168.1.10)
客户端(191.168.1.20)
一、服务端搭建
mkdir /etc/rsync
1、创建密码文件
echo "www_app:test" > /etc/rsync/web.pas #可以是非用户密码
2、创建配置文件
vim /etc/rsync/rsyncd.conf
编辑如下内容
# This line is required by the /etc/init.d/rsyncd script
#pid file = /var/run/rsyncd.pid
#port = 873
#address = 192.168.1.100 #服务器ip
uid = www_app
gid = www_user
#use chroot = yes
read only = yes
#limit access to private LANs
#hosts allow=192.168.1.0/255.255.255.0 10.0.1.0/255.255.255.0
#hosts deny=*
max connections = 5
#motd file = /etc/rsyncd.motd
#This will give you a separate log file
log file = /home/www_op/rsync/rsync.log
#This will log every file transferred - up to 85,000+ per user, per sync
#transfer logging = yes
log format = %t %a %m %f %b
syslog facility = local3
timeout = 300
[test]
path = /home/www_app/testdir
list=yes
ignore errors
auth users = www_app
secrets file = /etc/rsync/web.pas
comment = This is 192.168.1.100 testhome
#exclude = easylife/ samba/
#
[web]
path = /home/www_app/wwwroot/webhome/
list=yes
ignore errors
auth users = www_app
secrets file = /etc/rsync/web.pas
comment = This is 192.168.1.100 web home
3、启动
rsync --daemon --config=/etc/rsync/rsyncd.conf
4、重启
查询进程:ps -ef | grep rsync
杀掉进程:kill 进程号
启动进程:rsync --daemon --config=/etc/rsync/rsyncd.conf
二、客户端(191.168.1.10)
1、编辑密码文件,服务端配置的密码
echo "test" > web.pas
rsync --list-only --password-file=web.pas www_app@192.168.1.100::test
三、常见问题
1、场景一
@ERROR: auth failed on module test
rsync error: error starting client-server protocol (code 5) at main.c(1503) [receiver=3.0.6]
答:意思为认证失败
可能1:服务端web.pas 格式为 user:passwd,客户端web.pas 格式为:passwd
可能2:服务端 rsyncd.conf 密码文件配置错误
2、场景二
@ERROR: chroot failed
rsync error: error starting client-server protocol (code 5) at main.c(1503) [receiver=3.0.6]
答:服务端web.pas 权限不对,必须为chmod 600 web.pas
场景: 搭建服务同步源,客户端拉取同步文件
服务端(191.168.1.100)
客户端(191.168.1.10)
客户端(191.168.1.20)
一、服务端搭建
mkdir /etc/rsync
1、创建密码文件
echo "www_app:test" > /etc/rsync/web.pas #可以是非用户密码
2、创建配置文件
vim /etc/rsync/rsyncd.conf
编辑如下内容
# This line is required by the /etc/init.d/rsyncd script
#pid file = /var/run/rsyncd.pid
#port = 873
#address = 192.168.1.100 #服务器ip
uid = www_app
gid = www_user
#use chroot = yes
read only = yes
#limit access to private LANs
#hosts allow=192.168.1.0/255.255.255.0 10.0.1.0/255.255.255.0
#hosts deny=*
max connections = 5
#motd file = /etc/rsyncd.motd
#This will give you a separate log file
log file = /home/www_op/rsync/rsync.log
#This will log every file transferred - up to 85,000+ per user, per sync
#transfer logging = yes
log format = %t %a %m %f %b
syslog facility = local3
timeout = 300
[test]
path = /home/www_app/testdir
list=yes
ignore errors
auth users = www_app
secrets file = /etc/rsync/web.pas
comment = This is 192.168.1.100 testhome
#exclude = easylife/ samba/
#
[web]
path = /home/www_app/wwwroot/webhome/
list=yes
ignore errors
auth users = www_app
secrets file = /etc/rsync/web.pas
comment = This is 192.168.1.100 web home
3、启动
rsync --daemon --config=/etc/rsync/rsyncd.conf
4、重启
查询进程:ps -ef | grep rsync
杀掉进程:kill 进程号
启动进程:rsync --daemon --config=/etc/rsync/rsyncd.conf
二、客户端(191.168.1.10)
1、编辑密码文件,服务端配置的密码
echo "test" > web.pas
rsync --list-only --password-file=web.pas www_app@192.168.1.100::test
三、常见问题
1、场景一
@ERROR: auth failed on module test
rsync error: error starting client-server protocol (code 5) at main.c(1503) [receiver=3.0.6]
答:意思为认证失败
可能1:服务端web.pas 格式为 user:passwd,客户端web.pas 格式为:passwd
可能2:服务端 rsyncd.conf 密码文件配置错误
2、场景二
@ERROR: chroot failed
rsync error: error starting client-server protocol (code 5) at main.c(1503) [receiver=3.0.6]
答:服务端web.pas 权限不对,必须为chmod 600 web.pas
相关文章推荐
- Linux下的压缩解压缩命令详解
- Linux 查找软件安装路径
- linux dmesg命令参数及用法详解(linux显示开机信息命令)
- linux目录配置
- CentOS 6.7 x64 MySQL 5.7.9 编译安装
- Linux下使用extundelete实现文件/文件夹数据恢复
- linux下nexus搭建maven私有库自动打包
- linux下安装Maven
- [Linux] tar命令
- Linux学习笔记(四、目录处理命令)
- linux screen 命令详解
- lpxelinux启动linux
- kafka+zookeeper环境配置(Mac 或者 linux环境)
- CentOS6.5+Puppet3.7.3 安装、配置及测试
- unix && linux
- 学习Linux:第一周
- linux 下 Mysql 安装配置
- Linux PCI pci_dev 的创建
- linux 修改文件所在组
- pem方式登录的CentOS系统修改为密码登录方式