部署rsync服务器步骤整理(6.10)
一、服务端配置
- 先关闭防火墙与selinux:
[root@localhost ~]# sed -i ‘s#SELINUX=enforcing#SELINUX=disabled#g‘ /etc/selinux/config
[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce
Permissive
[root@localhost ~]# chkconfig iptables off
[root@localhost ~]# /etc/init.d/iptables stop
[root@localhost ~]# /etc/init.d/iptables status
iptables: Firewall is not running.
-
安装rsync服务
[root@localhost ~]# yum install -y rsync
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
- base: mirrors.njupt.edu.cn
- extras: mirrors.aliyun.com
- updates: mirrors.aliyun.com
base | 3.7 kB 00:00
extras | 3.4 kB 00:00
updates | 3.4 kB 00:00
Package rsync-3.0.6-12.el6.x86_64 already installed and latest version
- 编辑rsyncd配置文件并启动服务
#created by DanChen
#Email:624665255@qq.com blog: http://blog.51cto.com/9447803
##rsyncd.conf start##
uid = rsync #ent access username
gid = rsync #ent access group
use chroot = no
max connections = 200
timeout = 300
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsyncd.lock
log file = /var/log/rsyncd.log
[backup] #rsync module
path = /backup/
ignore errors
read only = false
list = false
hosts allow = 192.168.176.0/24 #permit ip address list
#hosts deny = 0.0.0.0/32 #deny ip address list
auth users = rsync_backup #auth username
secrets file = /etc/rsyncd.password #auth password
#rsync_config___end
启动服务:rsync –daemon
查询服务运行:
[root@localhost ~]# netstat -lnutp|grep :873
tcp 0 0 0.0.0.0:873 0.0.0.0: LISTEN 1670/rsync
tcp 0 0 :::873 ::: LISTEN 1670/rsync
- 创建rsync nologin用户
useradd -M -s /sbin/nologin rsync
- 创建密码验证文件
-
[root@localhost ~]# echo "rsync_backup:123456" >/etc/rsyncd.password
[root@localhost ~]# cat /etc/rsyncd.password
rsync_backup:123456
chmod 600 /etc/rsyncd.password
- 创建/backup文件夹并设置属主与权限
mkdir /backup –p
[root@localhost ~]# chown rsync.rsync /backup/
[root@localhost ~]# ls -ld /backup/
drwxr-xr-x. 2 rsync rsync 4096 Aug 8 22:32 /backup/
二、客户端配置
1.创建密码验证文件并设置600权限
[root@localhost ~]# echo "rsync_backup:123456" >/etc/rsyncd.password
chmod 600 /etc/rsyncd.password
- 创建/backup文件夹
mkdir /backup –p
3.查询是否安装rsync服务
[root@Kickstart-C610 backup]# rpm -ql rsync
安装服务yum -y install rsync*
4.测试传送文件
touch stu{1..3}
[root@Kickstart-C610 backup]# rsync -avz /backup/ rsync_backup@192.168.176.6::backup --password-file=/etc/rsyncd.password
sending incremental file list
./
stu1
stu2
部署rsync服务器步骤整理(CentOS 6.10)
原文:http://blog.51cto.com/9447803/2156698