Rsync安全配置

创建rsync的密码文件,格式 username:password

$ vi /etc/rsyncd.secrets

创建rsync共享配置文件

$ vi /etc/rsyncd.conf

添加如下内容:

pid file = /var/run/rsyncd.pid
port = 873 
uid = root
gid = root
use chroot = yes 
read only = no
max connections = 1000 
secrets file=/etc/rsyncd.secrets

#This will give you a separate log file
log file = /var/log/rsync.log
log format = %t %a %m %f %b
syslog facility = local3
timeout = 300 


#For ACL
hosts allow = 10.0.0.0/255.0.0.0
hosts deny = *

[transcode]
path=/home/test
read only = no
uid=root
gid=root

auth users = root


启动rsync server:rsync --daemon /etc/rsyncd.conf 

用法:rsync -rvaq --password-file=/data/secret.txt --delete --exclude "*.pyc" --exclude ".git"  username@ip:transcode/test.txt .

注意事项:本机上的/data/secret.txt文件里只需要保存密码即可,用户名已经在命令中有了,并且权限应为600。

你可能感兴趣的:(Rsync安全配置)