服務端
建立配置 vi /etc/rsyncd.conf
uid = nobody
gid = nobody
use chroot = no
max connections = 4
pid file = /data/service/rsync/test/rsyncd.pid
lock file = /data/service/rsync/test/rsync.lock
log file = /data/service/rsync/test/rsyncd.log
#ignore errors
hosts allow = 10.10.10.10(容許鏈接的IP)
hosts deny = 0.0.0.0/0
list = true(容許客戶端查看module)
#10.10.10.10
[backup] (module名稱)
path=/data/service/rsync/logs/ (備份路徑)
read only = false (可寫)
auth users = root (容許客戶端鏈接的用戶,多個可用",「分開)
secrets file = /etc/backserver.pas (密碼文件,格式爲user:pwd,權限爲600)
啓動rsync
rsync --daemon --password-file=/etc/rsyncd.conf shell
客戶端
rsync rsync://10.10.10.10 查看可用的module
rsync -avzP /source rsync://10.10.10.10/backup --password-file=/etc/client.pas(只須要密碼,權限爲600) ui
可根據本身須要去定時執行 code
Local: rsync [OPTION...] SRC... [DEST] Access via remote shell: Pull: rsync [OPTION...] [USER@]HOST:SRC... [DEST] Push: rsync [OPTION...] SRC... [USER@]HOST:DEST Access via rsync daemon: Pull: rsync [OPTION...] [USER@]HOST::SRC... [DEST] rsync [OPTION...] rsync://[USER@]HOST[:PORT]/SRC... [DEST] Push: rsync [OPTION...] SRC... [USER@]HOST::DEST rsync [OPTION...] SRC... rsync://[USER@]HOST[:PORT]/DEST