Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 09 Dec 2015 02:06:21 +0100
From:      "Michael Ross" <gmx@ross.cx>
To:        "Patrick Hess" <patrickhess@gmx.net>, dweimer <dweimer@dweimer.net>
Cc:        freebsd-questions@freebsd.org, owner-freebsd-questions@freebsd.org
Subject:   Re: Synchronizing directory hierarchies via SFTP
Message-ID:  <op.x9cqovk4g7njmm@workstation>
In-Reply-To: <44daceeebc9b2997663a88e485b83df9@dweimer.net>
References:  <13761006.QDN0LtKzYl@desk8.phess.net> <5263162.JaugYyUJYb@desk8.phess.net> <op.x9b54qh0g7njmm@workstation> <24246596.8z5VK3yfqz@desk8.phess.net> <44daceeebc9b2997663a88e485b83df9@dweimer.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Am .12.2015, 01:25 Uhr, schrieb dweimer <dweimer@dweimer.net>:

> On 2015-12-08 6:13 pm, Patrick Hess wrote:
>> Michael Ross wrote:
>>> Am .12.2015, 00:43 Uhr, schrieb Patrick Hess <patrickhess@gmx.net>:
>>> > 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.
>

lftp just calls out to the system ssh binary, so you can do that via

	sftp:connect-program "ssh -a -x -i yourprivatekeyfile"	

Courtesy of  
http://stackoverflow.com/questions/11577090/lftp-with-key-passphrase


Michael



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?op.x9cqovk4g7njmm>