博前小記:由於記錄在印象筆記中,感覺查看還是不太方便,將其轉成博文發在這裏,方便以後查閱和複習
環境:
服務:Linux 下 rsync 服務
客戶端:win下 cwRsync
啓動 Linux 下 rsync
1、修改 /etc/xinetd.d/rsync 文件中的 service rsync 項 disable 修改爲yes,使其能做爲服務進程啓動,配置如下
service rsync
{
disable = yes
flags = IPv6
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
2、修改rsync 的配置腳本(rsyncd.conf),配置如下:
secrets file = /etc/rsyncd.secrets #auth user and passwd
motd file = /etc/rsyncd.motd #welcome info and save location
read only = yes
uid = root
gid = root
hosts allow = 192.168.137.1
#hosts deny = 10.4.5.0/24
use chroot = no
max connections = 5
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
#模塊配置部分
[web]
comment = web
path = /home/test/software
read only = no
write only = yes
auth users = root
secrets file = /etc/rsyncd.secrets
3、修改或創建 secret file ,完成權限認證,(注,該文件必須爲 600 權限)配置如下:
root:123456
4、啓動
/usr/bin/rsync --daemon
win 下使用
由於我這裏只是要求把文件同步到服務器上,所以只設置可寫權限,最簡例子過程如下
rsync.exe -av rsync.html [email protected]::web // 把當前文件夾下的rsync.html 上傳到遠程服務器的web 模塊下
輸入密碼即可