ubuntu下配置rsync服務
1.新建/etc/rsyncd.conf
內容
motd file = /etc/rsyncd.motd
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsyncd.lock
log file = /var/log/rsyncd.log
[workspace]
path = /home/username/workspace
comment = Test
uid = username
gid = username
read only = false
auth users = username
secrets file = /etc/rsyncd.scrt
transfer logging = yes
注:實際使用中username必須是ubuntu用戶
2.新建/etc/rsyncd.scrt 密碼文件
username:whatever_password_you_want
3.新增/etc/rsyncd.motd 歡迎詞文件
Welcome to my rsync server!
4.重起rsyncd服務
/etc/init.d/rsync restart
5.客戶端同步指令
rsync -vr /home/username/test username@ip::workspace
安裝
在UBUNTU下安裝RSYNC通過以下步驟可以實現:
$ sudo apt-get install rsync xinetd
[編輯]配置
1. 編輯/etc/default/rsync 啟動rsync作為使用xinetd的守護進程
$ sudo vim /etc/default/rsync
RSYNC_ENABLE=inetd
2. 創建 /etc/xinetd.d/rsync 通過xinetd使rsync開始工作
$ sudo vim /etc/xinetd.d/rsync
service rsync
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
3. 創建 /etc/rsyncd.conf 配置rsync使其在.
$ sudo vim /etc/rsyncd.conf
max connections = 2
log file = /var/log/rsync.log
timeout = 300
[share]
comment = Public Share
path = /home/share
read only = no
list = yes
uid = nobody
gid = nogroup
auth users = user
secrets file = /etc/rsyncd.secrets
4. 創建 /etc/rsyncd.secrets 配置用戶名和密碼.
$ sudo vim /etc/rsyncd.secrets
user:password
4.a
$ sudo chmod 600 /etc/rsyncd.secrets
5. 啟動/重啟 xinetd
$ sudo /etc/init.d/xinetd restart
[編輯]測試
運行下面的命令檢查,確認rsync配置成功。
$ sudo rsync
[email protected]::share
Password:
drwxr-xr-x 4096 2006/12/13 09:41:59 .
drwxr-xr-x 4096 2006/11/23 18:00:03 folders