From owner-freebsd-questions@freebsd.org Wed Dec 9 00:37:16 2015 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29AB19D42C3; Wed, 9 Dec 2015 00:37:16 +0000 (UTC) (envelope-from dweimer@dweimer.net) Received: from webmail.dweimer.net (24-240-198-187.static.stls.mo.charter.com [24.240.198.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CFDD81878; Wed, 9 Dec 2015 00:37:14 +0000 (UTC) (envelope-from dweimer@dweimer.net) Received: from webmail.dweimer.local (localhost [192.168.5.2]) by webmail.dweimer.net (8.15.2/8.15.2) with ESMTPS id tB90PpYP020540 (version=TLSv1.2 cipher=DHE-RSA-CHACHA20-POLY1305 bits=256 verify=NO); Tue, 8 Dec 2015 18:25:51 -0600 (CST) (envelope-from dweimer@dweimer.net) Received: (from www@localhost) by webmail.dweimer.local (8.15.2/8.15.2/Submit) id tB90PpkN020539; Tue, 8 Dec 2015 18:25:51 -0600 (CST) (envelope-from dweimer@dweimer.net) X-Authentication-Warning: webmail.dweimer.local: www set sender to dweimer@dweimer.net using -f To: Patrick Hess Subject: Re: Synchronizing directory hierarchies via SFTP X-PHP-Script: www.dweimer.net/webmail/index.php for 192.168.5.1, 192.168.5.3 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 08 Dec 2015 18:25:51 -0600 From: dweimer Cc: freebsd-questions@freebsd.org, owner-freebsd-questions@freebsd.org Organization: dweimer.net Reply-To: dweimer@dweimer.net Mail-Reply-To: dweimer@dweimer.net In-Reply-To: <24246596.8z5VK3yfqz@desk8.phess.net> References: <13761006.QDN0LtKzYl@desk8.phess.net> <5263162.JaugYyUJYb@desk8.phess.net> <24246596.8z5VK3yfqz@desk8.phess.net> Message-ID: <44daceeebc9b2997663a88e485b83df9@dweimer.net> X-Sender: dweimer@dweimer.net User-Agent: Roundcube Webmail/1.1.3 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2015 00:37:16 -0000 On 2015-12-08 6:13 pm, Patrick Hess wrote: > Michael Ross wrote: >> Am .12.2015, 00:43 Uhr, schrieb Patrick Hess : >> > Just came across LFTP, http://lftp.yar.ru. According to the feature list, >> > it has support for SFTP and also comes with a "built-in mirror and >> > reverse mirror" option. >> >> lftp is used a lot here to mirror directories via sftp. Would >> recommend. > > Tried it today, works like a charm. In comparison to csync, I noticed > that the initial directory traversal in particular is a lot faster > with LFTP. And since there's still a big question mark behind sshfs > regarding its stability on FreeBSD, I'll just settle for LFTP and > call it a day. > >> Check out the fine-tuning available with "set -a". > > Wow, that's a lot of stuff to mess up... Maybe some other day. > So far, the defaults seem to work just fine for me. > > Patrick > > PS: Here's the quick'n'dirty Expect script I hacked together, > in case someone has a use for it. > _______________________________________________________________________ > > expect -c ' > set timeout -1; > > spawn lftp -u '"$SFTP_USERNAME"' sftp://'"$SFTP_SERVER"'; > > expect "Passwor\[dt\]:"; > send "'"$SFTP_PASSWORD"'\r"; > > expect "lftp *> "; > send "mirror -v --reverse --dereference --delete --overwrite > --exclude-glob *.swp '"$LOCAL_DIR"' '"$REMOTE_DIR"'\r" > > expect "lftp *> "; > send "quit\r"; > > expect eof; > ' > _______________________________________________________________________ > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "freebsd-questions-unsubscribe@freebsd.org" I am not familiar with lftp, so it may not have support for it, but if it were me doing this, I would look into using public/private OpenSSH key pairs instead of sending the password with the expect script. -- Thanks, Dean E. Weimer http://www.dweimer.net/