From owner-freebsd-questions@FreeBSD.ORG Mon Sep 4 08:15:19 2006 Return-Path: X-Original-To: freebsd-questions@FreeBSD.ORG Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BC12D16A4DE for ; Mon, 4 Sep 2006 08:15:19 +0000 (UTC) (envelope-from norgaard@locolomo.org) Received: from strange.daemonsecurity.com (59.Red-81-33-11.staticIP.rima-tde.net [81.33.11.59]) by mx1.FreeBSD.org (Postfix) with ESMTP id DCBAA43D68 for ; Mon, 4 Sep 2006 08:14:56 +0000 (GMT) (envelope-from norgaard@locolomo.org) Received: from [192.168.7.193] (68.Red-80-34-55.staticIP.rima-tde.net [80.34.55.68]) by strange.daemonsecurity.com (Postfix) with ESMTP id E823F2E02A; Mon, 4 Sep 2006 10:14:54 +0200 (CEST) Message-ID: <44FBE07D.9070004@locolomo.org> Date: Mon, 04 Sep 2006 10:14:53 +0200 From: Erik Norgaard User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) MIME-Version: 1.0 To: Gary Kline References: <20060904043500.GA8617@thought.org> In-Reply-To: <20060904043500.GA8617@thought.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: FreeBSD Mailing List Subject: Re: time to come clean... . X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Sep 2006 08:15:19 -0000 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/ $RSYNC_USER\@$RSYNC_HOST:$RSYNC_PATH; else rsync -Cptuvaz --rsh="ssh" \ $RSYNC_PATH/ $RSYNC_USER\@$RSYNC_HOST:$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