rsyncd

Posted gaiting

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了rsyncd相关的知识,希望对你有一定的参考价值。

一 .服务端

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的主要内容,如果未能解决你的问题,请参考以下文章

重启rsyncd

rsync

配置rsync

配置rsync

rsync拉取模式同步文件

rsync启动不了.运行/usr/bin/rsync --daemon --config=/etc/rsyncd/rsyncd.conf后,