# mcedit /etc/rsyncd.conf max connections = 2 motd file = /etc/rsync.motd log file = /var/log/rsync.log pid file = /var/run/rsync.pid lock file = /var/run/rsync.lock timeout = 300Creating the secrets file on /etc/rsyncd.secrets, and add the usernames and the passwords, one per line, separated by a colon (:)[Test] comment = "Backup Testing" path = /mnt/share uid = root gid = root list = true use chroot = no read only = no list = yes auth users = root, merkurius, venus, jupiter secrets file = /etc/rsyncd.secrets hosts allow = 192.168.1.0/255.255.255.0
# mcedit /etc/rsyncd.secretsFinally, change the permission of this file so it can't be read or modified by other users.root:password merkurius:Password venus:passworD jupiter:PassWord
# chmod 600 /etc/rsyncd.secretsEdit /etc/xinetd.d/rsync
# mcedit /etc/xinetd.d/rsyncTesting from Localhostservice rsync { disable = no socket_type = stream wait = no user = root server = /usr/bin/rsync server_args = --daemon log_on_failure += USERID }
# rsyncd root@localhost:: Test "Backup Testing"or
#rsync rsync://root@localhost Test "Backup Testing"Testing from another computer
# rsync -avzr root@192.168.77.194::Test /tmp/test/As another user : merkuriusPassword:******* receiving incremental file list ./ new.txt sent 76 bytes received 216 bytes 83.43 bytes/sec total size is 71 speedup is 0.24
# rsync -avzr merkurius@192.168.77.194::Test /tmp/test/Check ResultPassword:***** receiving incremental file list ./ install.log sent 81 bytes received 8707 bytes 2510.86 bytes/sec total size is 35011 speedup is 3.98
# ls -al /tmp/test/As shown above, all file are belong to root, because we specify uid and gid as root, when rsync run as daemon, we can specify which user and group owns the files that are transfer from and to.total 48 drwxr-xr-x 2 root root 4096 Nov 28 17:08 . drwxrwxrwt. 14 root root 4096 Nov 28 17:01 .. -rw-r--r-- 1 root root 34940 Nov 28 17:08 install.log -rw-r--r-- 1 root root 71 Nov 28 16:57 new.txt
Done
No comments:
Post a Comment