S�ren Neigaard <[EMAIL PROTECTED]> wrote:

>If I use the following command manually:
>
>/usr/bin/rsync --rsh=/usr/bin/ssh -aurvlq --delete /projects/
>MY_IP_ADDRESS:/projects
>
>I get asked for the root password, and "projects" gets syncronized :)
>
>But how do I do this from a bash shell script, so that it automatic uses the
>root password?

If encryption of the data stream isn't necessary, you could also setup an 
rsync server.  This involves creating a service or share in 
/etc/rsyncd.conf and instructing rsync to listen for incoming connections, 
usually via inetd.  Add the following to /etc/services (it may already be 
included):

rsync           873/tcp                         # rsync

For older releases that use inetd you need to add the following to 
/etc/inetd.conf:

# rsync server
rsync   stream  tcp     nowait  root    /usr/bin/rsync rsyncd --daemon

Newer releases running xinetd generally have an rsync configuration file in 
/etc/xinetd.d, in which case you just need to enable the service.  Don't 
forget to restart inetd or xinetd.

In /etc/rsync.d, you'd need something like this:

[servicename]
         path = /path/to/data
         uid = 0
         gid = 0
         read only = yes
         hosts allow = some.host

I normally set the shares to read only and "get" the data from the remote 
server.  It prevents accidental overwrites of source data.  The uid/gid 
options may not be necessary depending on the ownership of the source data, 
but are useful if you want to make sure you aren't prevented from 
retrieving any files.  'man rsyncd.conf' for more details.

I use both methods (rsync as a daemon and rsync over ssh) for a variety of 
purposes and have found rsync most useful.

HTH

-Eric


Eric Sisler <[EMAIL PROTECTED]>
Applications Specialist
Westminster Public Library
Westminster, CO USA

Linux - Don't fear the Penguin.
Want to know what we use Linux for?
Visit http://gromit.westminster.lib.co.us/linux



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to