Administration
  Home arrow Administration arrow Page 7 - File Synchronization With Rsync
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ADMINISTRATION

File Synchronization With Rsync
By: icarus, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 91
    2002-12-04


    Table of Contents:
  • File Synchronization With Rsync
  • Getting The Skinny
  • Building Blocks
  • Temporary Insanity
  • Remote Control
  • Doing More
  • What's In A Name?
  • Mirror, Mirror, On The Wall
  • Link Out

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    File Synchronization With Rsync - What's In A Name?
    ( Page 7 of 9 )

    Thus far, all the examples you've seen have involved so-called anonymous access to the rsync server - any user could connect to the host server and transfer files between the two systems. Needless to say, this is both insecure and dangerous - it's quite possible, for example, for someone to mistakenly sync up an empty directory with the "--delete" option, thereby destroying files on the destination machine.

    In order to add a greater level of security, therefore, rsync comes with a simple authentication scheme, which requires users to log in to the rsync server with a password before performing any file transfer operation. This authentication can be activated on a per-module basis, and involves adding the "auth users" and "secrets file" variables to each module in the configuration file.

    The "auth users" variable tells rsync which users are authorized to access the corresponding module on the server, while the "secrets file" variable tells rsync which file to use for password authentication. Here's an example:
    [home]
       path = /home/me
       auth users = john, joe, sherry
       secrets file = /home/me/rsync-users
    In this case, only the users "john", "joe" and "sherry" are permitted access to the module "home", and their passwords can be verified against the data in the file "rsync-users". It's important to ensure that this file is not world-readable.

    This secrets file is a simple text file containing a list of comma-separated usernames and passwords, each set on a new line. Here's an example:
    [me@olympus] $ cat rsync-users
    john:john
    joe:joe
    sherry:g5473m
    Note that these users need not necessarily be "real" users on the system.

    Let's now update our configuration file to include some authentication for the "home" module, and restart the rsync daemon on "olympus":
    [home]
       path = /home/me
       comment = My Home Area
       list = yes
       read only = no
       auth users = john, joe
       secrets file = /tmp/rsync-users
    This time, when I attempt to connect to the rsync server from "xanadu", look what happens:
    [me@xanadu] $ rsync --progress --recursive joe@olympus::home/ .
    Password: ***
    It's only after entering the correct password for user "joe" that I'm allowed access to the module. Note the manner in which the username is specified, by prefixing it to the host name on the command line.

    Finally, you can use SSH for your rsync transfers by specifying the path to the "ssh" binary in your rsync command line:
    [me@xanadu] $ rsync -rsh=/usr/bin/ssh --progress  --recursive
    olympus:home/ .          
    In this case, rsync will use SSH to perform the transaction. Note the single colon in the destination host name - this tells rsync to use the SSH shell instead of connecting to the rsync server directly.

    You can also use the "hosts allow" and "hosts deny" options to restrict access to the server by host - take a look at the documentation for details.

     
     
    >>> More Administration Articles          >>> More By icarus, (c) Melonfire
     

       

    ADMINISTRATION ARTICLES

    - Network Booting via PXE: the Basics
    - Scalix: Linux Administrator`s Guide
    - Network Administration with FreeBSD 7
    - Components of an Information Architecture
    - The Anatomy of an Information Architecture
    - Configuring Load-Balanced Clusters
    - Load-Balanced Clusters
    - UNIX Time Format Demystified
    - Making Changes in the CVS
    - Building Your First CVS Repository
    - CVS Quickstart Guide
    - Authorizing Users in Samba
    - Handling User Accounts in Samba
    - Authentication in Samba
    - Accounts, Authentication, and Authorization





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    Stay green...Green IT