rsync is a software application for Unix systems which synchronizes files and directories from one location to another while minimizing data transfer using delta encoding when appropriate. rsync copies only the diffs of files that have actually changed, compressed and through ssh if you want to for security. The rsync server is referred to as the backup server. An rsync server can backup the data of multi clients, and multi rsync servers can also backup the data of one client.
Server configuration
1. Open the /etc/rsyncd.conf file, and add the following lines.
uid = nobody
gid = nobody
use chroot = no
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
[test1]
path = /home/joker/test1
comment = home joker test1
ignore errors
read only = yes
list = no
auth users = joker
secrets file = /etc/rsyncd.scrt
2. Add user name and password to the /etc/rsyncd.scrt file.
# echo “joker:seneca99” >> /etc/rsyncd.scrt
# chmod 600 /etc/rsyncd.scrt
3. Modify the /etc/xinetd.d/rsync file, and change the “disable=yes” to “disable=no”. Then start the rsync service.
# service xinetd restart
4. Create the “test1” directory under the user joker home directory.
$ mkdir /home/joker/test1
Client test
1. Create the test1 directory and create a file named testfile in it.
$ mkdir /home/joker/test1
$ vi testfile
2. Copy the testfile to the server using rsync command.
$ cd ~/test1
$ rsync –avz testfile joker@129.168.189.133:test1
sending incremental file list
testfile
send 577 bytes received 31 bytes 135.11 bytes/sec
total size is 101124 speedup is 166.32
3. On the server side, I found that the file had been copied to the test1 directory.