Skip to content

Instantly share code, notes, and snippets.

@Ivlyth
Created May 27, 2015 10:20
Show Gist options
  • Save Ivlyth/3edfd824cc9eba31fefd to your computer and use it in GitHub Desktop.
Save Ivlyth/3edfd824cc9eba31fefd to your computer and use it in GitHub Desktop.
设置 rsync
脚本 http://w.myth.ren/rsync_mgr.py
rsync.conf
########## Global Config ##########
pid file = /home/myth/tmp/rsync/rsyncd.pid
lock file = /home/myth/tmp/rsync/rsync.lock
log file = /home/myth/tmp/rsync/rsync.log
port = 873
uid = root
gid = root
use chroot=yes
max connections = 65535
timeout = 10
&include /home/myth/tmp/rsync/modules.d
modules.d/what.conf
[what]
path = /home/myth/tmp/rsync/test/what
read only = no
ignore errors
list = true
auth users = what
secrets file = /home/myth/tmp/rsync/pass.d/what.pass
pass.d/what.pass
what:L25PibHb
pass.d/下的文件权限万为 600, 属主为 root:root
### 初始化
python rsync_mgr.py init
### 启动 rsync
/home/myth/tmp/rsync/bin/rsync --daemon --config=/home/myth/tmp/rsync/rsync.conf
### 添加一个用户
python rsync_mgr.py add what
### 测试推送
rsync -avzP --password-file=/path/to/client.pass /path/to/local-path/ [email protected]::what/
/path/to/client.pass 中存放的是由我们提供的密码
/path/to/local-path/ 是用户想要同步的本地文件夹
### 删除一个用户
python rsync_mgr.py del what
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment