Gary Kline wrote:

        I've just installed/reinstaled rsync here on ns1.thought.org (aka
        "sage") and on zen.thought.org.  I've fiddled with the rsyncd.conf on
        both FBSD systems.  What I don't understand is how rsync, using
        ssh, gets past the secret password.  If, say, I want to
        copy all of my www files from sage to zen, what do I put
        into /usr/local/etc/rsyncd.secrets? Let's say that rsyncd.secrets
        had:

        # User : pw
        root : abcd
        kline: wxyz

I'd use ssh keys, check the man page on how to specify keys for use with rsync/ssh.

rsync --verbose  --progress --stats --compress --rsh=/usr/local/bin/ssh
      --recursive --times --perms --links --delete \
      --exclude "*bak" --exclude "*~" \
      /usr/local/www/* zen.thought.org:/usr/local/www

Careful with wildcards, they may be interpreted different than you expect.

I made this script, the script assumes that paths are the same on source and destination:

#!/bin/sh
# RSYNC_USER is set as an environment variable or defaults to $USER
RSYNC_USER=${RSYNC_USER:-$USER}

# Exit if RSYNC_HOST not defined, there is no good default value.
if [ -z $RSYNC_HOST ]; then
  echo "RSYNC_HOST undefined, no host to syncronize with.";
  exit;
fi

# RSYNC_PATH sets the path to be syncronized, defaults to $HOME
# would be neat to check if path is absolute or else assume relative
# to $HOME or set RSYNC_PATH as environment/command line variable
if [ -z $1 ]; then
  RSYNC_PATH=$HOME;
else
  RSYNC_PATH=$HOME/$1
fi
# Syncronize folders
echo "Syncing $RSYNC_PATH..."

# Exclude patterns may be stored in .rsync in the home directory or
# the sub directory being syncronized
if [ -f $RSYNC_PATH/.rsync ]; then
  rsync -Cptuvaz --rsh="ssh" --exclude-from=$RSYNC_PATH/.rsync \
    $RSYNC_PATH/ [EMAIL PROTECTED]:$RSYNC_PATH;
else
  rsync -Cptuvaz --rsh="ssh" \
    $RSYNC_PATH/ [EMAIL PROTECTED]:$RSYNC_PATH;
fi

exit;

You put your exclude list in a file, .rsync (see the man-page), what to exclude may depend on the directory you're rsyncing. If you're automating this as a cron-job, then you may not have the environment variables set.

I think that rsync defaults to ssh so the --rsh is really obsolete, but I like to make it explicit.

Cheers, Erik
--
Ph: +34.666334818                      web: http://www.locolomo.org
X.509 Certificate: http://www.locolomo.org/crt/8D03551FFCE04F0C.crt
Key ID: 69:79:B8:2C:E3:8F:E7:BE:5D:C3:C3:B1:74:62:B8:3F:9F:1F:69:B9
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to