RSYNC SERVER
Remote file transfer protocol
Rsync is a linux in-built file transfer program that is similar to RCP or SCP. It includes the added feature of allowing just the differences between two sets of files on two machines to be transferred across the network.
Rsync sends un-encrypted traffic over the network, but can this can also be tunneled through SSH.
The Rsync listens on port 873.
Here’s a quick how-to for configuration of Rsync Server.
Follow these steps:
1. vi /etc/rsyncd.conf
2. Edit the above file.
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
[data]
path=/data/
comment=html file
uid = daemon
gid = daemon
read only = no
list = yes
auth users = daemon
secrets file = /etc/sec/ibn-admin
max connections = 10
[data] ----> This is module name that will called from remote server
path ----> This is the actual path of data, that is need to transfer
comment ----> Here is just a comment for the module
uid ----> The user for the data path
gid ----> The group for the data path
read only ----> This defines mode… if it set to “YES” the no one can write on this data path remotely using Rsync
max connections ----> limit connection per module
auth users ----> provide security for the module “here user daemon will be authenticated”
secrets file ----> password file for “auth users”
· vi /etc/sec/ibn-admin (choose your own path)
daemon:syncadmin
Format for above “secrectsfile” is: username:password
At end save file
Run this command
#chmod 600 /etc/sec/ibn-admin
Now you have to run “Rsync as daemon (background process)”
#rsync –daemon
Note: I run this as:
#/bin/nice -n 15 /usr/bin/ionice -c2 -n0 /usr/bin/rsync –daemon
Now you server is able to listen for server Rsync and connections on port no. 873
Check this by issuing this command as ROOT:
ps aux | grep rsync
should get this like output:
root 1546 0.0 0.0 65488 472 ? SNs Jul17 1:08 /usr/bin/rsync –daemon
# netstat -tnulp | grep -i Rsync (as root)
tcp 0 0 0.0.0.0:873 0.0.0.0:* LISTEN 1546/rsync
tcp 0 0 :::873 :::* LISTEN 1546/Rsync
Now from a remote server run this, to copy file on server.
# echo “syncadmin” > /opt/passwd-data
# chmod 700 /opt/passwd-data
rsync –avz --password-file=/opt/passwd-data daemon@172.32.1.1::data /opt/
Format: Rsync –avz
You need to copy file from Development Server to production server on some delay of time (like every 1 min.. or so on)
Then just make cron for above rsync command:
#crontab –e
*/2 * * * * rsync –avz --password-file=/opt/passwd-data daemon@172.32.1.1::data /opt/
That is it….
No comments:
Post a Comment