Installing and configuring rsync server on CentOS 5 and use rsync client.

Sometimes you need to copy some files to one or number of the remote hosts and keep them updated with the latest version. In my example, I will be running performance tests and want to make sure each agent has the latest version. So, I am making changes on my Linux desktop and need to update all clients with the last changes. Yea, yea, I am aware about source control systems, however there are number of the reasons you can NOT to use them. As an example, you load generation machine may be located in the network sub-set where you should not have any code. So, there is some type of the deploying the code on certain machine. In the same time, and it is obvious you cannot use your Linux desktop in the corpnet to start any tests.

So, syncing the remote load generators with the certain libraries on your local machine may be done using rsync.

Configuring the server:

Install xinetd and rsync packages and make sure xinetd is running on levels 3, 4 and 5
$> sudo yum -y install xinetd rsync
$> sudo /sbin/chkconfig --level 345 xinetd on

Modify rsync xinetd configuration, and change disable = yes to disable = no
$> sudo vim /etc/xinetd.d/rsync

Create rsync secrets file for passwords with format of username:password.
$> sudo vim /etc/rsyncd.secrets

Create configuration for rsync shares
$> sudo vim /etc/rsyncd.conf

Example of using rsyncd.conf. Use man rsync or samba documentation for more details

## rsyncd.conf
secrets file = /etc/rsyncd.secrets
motd file = /etc/rsyncd.motd
read only = yes
list = yes
uid = nobody
gid = nobody

[out]
comment = IDML Perf code
path = /home/path/to/your/code/to/rsync

[confidential]
comment = For your eyes only
path = /home/rsync/secret-out
auth users =
hosts allow = *
hosts deny = *.microsoft.com
list = false

Fix up permissions and ownership, and restart xinetd service
$> sudo chown root.root /etc/rsyncd.*
$> sudo chmod 600 /etc/rsyncd.*
$> sudo /sbin/service xinetd restart

Test it out locally, you should get @RSYNCD:
$> telnet 127.0.0.1 873

IPTables Firewall

Add an iptables entry for rsync’s port.
$> sudo vim /etc/sysconfig/iptables

Add the following entry somewhere near the other protocols, but before the final drop line.

#
# rsync - add entry to allow 192.168.0.* to connect to our rsync server.
#
-A INPUT -s 192.168.0.0/255.255.255.0 -p tcp -m tcp --dport 873 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 873 -j DROP

Or use the GUI:

Start -> run command
Type system-config-selinux there and click Run
In the Security level dialog, escape "Other ports"
add port 873 for both TCP and UDP
Click Ok, confirm it by clicking Yes and start using it

Running the client:

On the remote machine:
$> rsync -arv your-user-name@host-with-code-to-sync:/home/path/to/your/code/to/rsync ./

And process has been started.

Enjoy !!!!

7 Comments

Filed under technology

7 Responses to Installing and configuring rsync server on CentOS 5 and use rsync client.

  1. hony22

    Great post!

  2. SaryRodin72

    Saved as a favorite, I really like your web site!

  3. Hello are using blog engine for your blog platform? I’m new to the blog world but I’m trying to get started and create my own. Do you need any html coding expertise to make your own blog? Any help would be greatly appreciated!

  4. cool, I realy like this, thank you very much. It’s usefull.

  5. Nithya

    How to schedule a directory copy from windows to linux

Leave a Reply

Your email address will not be published. Required fields are marked *