码迷,mamicode.com
首页 > 其他好文 > 详细

rsyncd

时间:2020-02-14 16:41:53      阅读:75      评论:0      收藏:0      [点我收藏+]

标签:txt   word   systemd   sts   密码文件   lock file   全局   nbsp   bsp   

一 .服务端

1 更改配置文件

[root@ localhost ~]#  vim /etc/rsyncd.conf 
#全局配置                       
uid = root
gid = root
use chroot = no
max connections = 200
timeout = 300
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log

###模块配置                     
[backup]
path = /data
ignore errors
read only = false
list = false
hosts allow = 10.0.0.0/24
hosts deny = 0.0.0.0/32
auth users = rsync_backup
secrets file = /etc/rsync.password

  

2 创建配置文件中提到的备份目录和用户

[root@ localhost ~]# mkdir -p /data
[root@ localhost ~]# useradd rsync -s /sbin/nologin -M
[root@ localhost ~]# chown -R rsync.rsync /data/

3 创建认证用户密码 权限

[root@ localhost ~]# echo "rsync_backup:123456" >/etc/rsync.password
[root@ localhost ~]# chmod 600 /etc/rsync.password 

4 重启rsync 设置守护进程

[root@ localhost ~]# systemctl start rsyncd.service
[root@ localhost ~]# systemctl restart rsyncd.service
[root@ localhost ~]# systemctl enable rsyncd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/rsyncd.service to /usr/lib/systemd/system/rsyncd.service.

 

二.客户端

1.创建密码文件

[root@ localhost ~]# echo "123456">/etc/rsync.password
[root@ localhost ~]# chmod 600 /etc/rsync.password  

2 测试推送文件

[root@ localhost ~]# rsync -avz aaa.txt rsync_backup@10.0.0.49::backup --password-file=/etc/rsync.password

sending incremental file list
aaa.txt

sent 70 bytes  received 27 bytes  194.00 bytes/sec
total size is 2  speedup is 0.02

 

  

 

rsyncd

标签:txt   word   systemd   sts   密码文件   lock file   全局   nbsp   bsp   

原文地址:https://www.cnblogs.com/gaiting/p/12307757.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!