- Transferring Files on Linux Platform (Tested with 1.5 TB of Data).
- Admin Required to take Incremental Backups.
- Want to keep Files Synced.
Tested on Fedora/Centos Linux Platforms (But Surely it works on all Distros)
Before Starting you should have xinetd working on your Linux Distro
Before Starting you should have xinetd working on your Linux Distro
Read More About Xinetd
XINETD
XINETD
Now Lets Start .
What is Rsync ?
Rsync is a free software computer program for Unix and Linux like systems which synchronizes files and directories from one location to another while minimizing data transfer using delta encoding when appropriate. An important feature of rsync not found in most similar programs/protocols is that the mirroring takes place with only one transmission in each direction.
Installing Rsync
How do I install Rsync?
Use one of the following commands to install Rsync.
If you are using Debian Based like Ubuntu Linux, Execute the following command
# apt-get install rsync
OR
$ sudo apt-get install rsync
If you are using Red Hat Enterprise Linux (RHEL) type the following command
# up2date rsync
If you are using CentOS/Fedora Core Linux, type the following command
# yum install rsync
Always use Rsync over ssh
Since Rsync does not provide any security while Transferring data it is recommended that you use rsync over ssh . This allows a secure remote connection.
You Can Find Some Good Example Here
Rsync Examples
Rsync Examples
Setting Up Rsync Server
You Need to Create or Edit Three File which would make you start Rsync server
- /etc/rsyncd.conf
- /etc/rsyncd.secrets
- /etc/xinet.d/rsync
Lets Get in Details of all this 3 files
1. Rsyncd.conf
1. Rsyncd.conf
max connections = 5
log file = /var/log/rsync.log
timeout = 300
[backup]
comment = Anything You would like to Notify
path = /your/real/path/to_the_directory
read only = yes
list = yes
uid = root
gid = root
use chroot = no
auth users = pub
secrets file = /etc/rsyncd.secrets
The above Files say maximum connection to the server will be 2, log file to write for debugging and information about the process, timeout is set to be 300
The Next [backup] tells what should be the canonical name to the directory we have shared in the above case it is given by “path = /your/real/path/to_the_directory” (It is Similar to Samba if you have Used)
read only = yes Permission to the Directory Shared is Given Read
auth users = pub Only this user have the permission to view the directory.
secrets file = /etc/rsyncd.secrets contains the usernames and passwords
The Next [backup] tells what should be the canonical name to the directory we have shared in the above case it is given by “path = /your/real/path/to_the_directory” (It is Similar to Samba if you have Used)
read only = yes Permission to the Directory Shared is Given Read
auth users = pub Only this user have the permission to view the directory.
secrets file = /etc/rsyncd.secrets contains the usernames and passwords
2. Rsyncd.secrets
Contains the Usernames and Passwords colon ” : ” seperated
Contains the Usernames and Passwords colon ” : ” seperated
pub:pub
Now the Super daemon Xinetd need to handle the Rsync daemon so
Just Copy the Above code where disable should be no.
Restart Xinetd
# default: off
# description: The rsync server is a good addition to an ftp server, as it \
# allows crc checksumming etc.
service rsync
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
Just Copy the Above code where disable should be no.
Restart Xinetd
/etc/init.d/xinetd restart
Hoooraaayyyy We have setup the server now Check it from any remote machine having rsync.
rsync rsync://pub@ipaddr
where pub = username in the rsyncd.conf with the password specified in rsyncd.secrets
Note : rsyncd.secrets file should have only read permission from root.