Automate Rsync without Password using Rsync Daemon
In order to automate rsync without any password or transports, we need to setup the rsync daemon on one of the server. Suppose we want to sync data from a slave server to a live server.
Configuring the Slave Server
In the slave server we have to run the rsync daemon which accepts connections from live. Inorder to do this, we have to first edit the
/etc/rsyncd.conf
Add an entry in
/etc/rsyncd.conf
with the following template
[Module_Name]
path = Filesystem_Path
comment = Comment
auth users = Authenticated_Users
secrets file = User_Password_file
hosts allow = IP_Addresses
The parameters as shown in italics have to be edited.
- Module_Name : A name to the module
- Filesystem_Path : The folder that is to be synced
- Comment : A comment about the entry
- Authenticated_Users : List of users separated by space who can access the module / path
- User_Password_file : The location of the file containing the username and passwords
- IP_Addresses : List of IP Addresses that can connect to the rsync daemon to sync.
The User_Password_file is a file which is only readable by the rsync daemon. The contents of the file have the template
User:Password
An example implementation of the rsyncd.conf and password file is as shown below.
[images]
path = /var/www/images/
comment = Images copy
auth users = user123
secrets file = /etc/rsyncd.secret
hosts allow = 192.168.1.2 192.168.1.34
Contents of rsyncd.secret
user123:password123
It is to be noted that the permission of the secret file should be 400, i.e, readable only by the owner that is the process which runs rsync
chmod 400 rsyncd.secret
Finally start the rsync daemon using the command
rsync --daemon
Configuration on Live Server
In the slave server you just have to run the command
rsync -r rsync_user@rsync_host::rsync_module Target_Folder --password-file Password_File
The parameters as shown in italics have to be edited.
- rsync_user : Name of the user that has access to the Module with Module_Name
- rsync_host : The server running rsync daemon
- rsync_module : Name of the rsync module
- Target_Folder : The target folder that has to be synced with the module.
- Password_File : The location of the file containing the password
A sample command would be
rsync -r user123@192.168.1.1::images /live/images --password-file rsync.pwd
Contents of rsync.pwd
password123
The password file would also have the same properties as the secret file discussed in server configuration.
Thus running this would sync Alternatively adding this command on a cron job could help you sync periodically.
192.168.1.1:/var/www/images to 192.168.1.X:/var/www/images
Happy Syncing...
- Enable Right Click Paste In Linux
- Camera Driver For Sony Vpccw26fg Windows7
- Dell Studio 14z Vs Sony Vaio Cw
- Sony Vaio Cw Linux Compatible
- Canon Sx120is Ubuntu Camera
- Reviews About Sony Vaio Vpccw26fg
- Windows 32 Bit Or 64 Bit
- Usable Ram 1500 Speed
- Gddr3 Graphics Ram On Sony Vaio Vpccw26fg
- Pyramid Division Multiplication Addition Subtraction Puzzle
- Dell Inspiron 15 Review Linux Compatible
- Error Getting Mechanize
- Accessible Of Drupal
- New Folder Exe Removal Tool
- New Svchost.exe Removal Tool

Comments
Post new comment