Sunday, 13 January 2013

Rsync server on RedHat/Cent OS Linux

  1. Yum install rsync & xinetd
  2. Mkdir /var/www/html/share
  3. Create a file: "/etc/rsyncd.conf", with the contents:
max connections = 2
log file = /var/log/rsync.log
timeout = 300
[share]
comment = Random things available for download
path = /var/www/html/share
read only = yes
list = yes
uid = nobody
gid = nobody
auth users = pub
secrets file = /etc/rsyncd.secrets
hosts allow = 192.168.176.0/24
  1. Create a file: "/etc/rsyncd.secrets", and add the below line
pub:pub
  1. Run Setup  system services  and enable rsync
  1. vim /etc/xinetd.d/rsync
modify disable = yes To disable = no
  1. chown root.root /etc/rsyncd.*
  1. chmod 600 /etc/rsyncd.*
  1. service xinetd restart
  1. chkconfig xinetd on
How to test your rsync setup:
  1. Run: "rsync rsync://pub@your-ip-or-hostname/". After entering your password (also pub), rsync should list the only available share, pub.
  2. Run: "rsync rsync://pub@your-ip-or-hostname/pub/". After entering your password, rsync should now give a file listing. If there are no files listed, place some files and directories in the directory and try again.
  3. Run: "rsync -v --progress --partial rsync://pub@your-ip-or-hostname/pub/someFile ." (you can abbreviate --partial --progress as -P). Your file should now be downloading.
  4. Run: "rsync -aPv rsync://pub@your-ip-or-hostname/pub/someDirectory .". Your directory should now be downloading.
Changelog:


2007-01-07, Ranjit Singh suggested pointing out that module parameters are usable in the global section. 2006-04-01, Franz-Robert van Vugt suggested the alternate method of restarting xinetd.
2005-10-24, added xinetd info (thanks Jeff Silverman and S. Anbalagan), and information on allowing/denying certain IP addresses (suggested by Jeff), edited various minor portions (including testing section).
2004-12-17, added note about "nogroup" (thanks Michael Farrell).
2003-05-18, fixed spelling error (rsnycd.conf).
2002-10-14, updated config (logging).

Note: To disable auth user comment the below lines in /etc/rsyncd.conf

auth users = pub
secrets file = /etc/rsyncd.secrets

Extra configuration (Optional)

Find out if selinux is running.  You can either look in the configuration file located at /etc/selinux/config or just try to look at the variable we are going to disable.
$ sudo /usr/sbin/getsebool rsync_disable_trans
rsync_disable_trans --> off
So this tells us that selinux is running and that rsync is being protected by selinux.  The on/off is a bit confusing, but off means nothing will get to your rsync daemon.  Let's change that.. and restart the xinetd service

 # setsebool -P rsync_disable_trans 1
# service xinetd restart

No comments:

Post a Comment