2

I'm relatively new to posting here, so please pardon infelicities.

I'm trying to set up a duplicity backup through a 2-step ssh tunnel that I set up in config with one alias - call that alias "faraway". So for example ssh faraway works fine (with the right key in ssh-agent). But then when I try

duplicity local-dir sftp://faraway//remote-dir/

I get

BackendException: ssh connection to [second-remote-server] failed: timed out

I read somewhere that duplicity reinvents ssh in python or something, so I'm guessing that has to do with the problem, but I don't know to fix it.

Bonus questions: I'd really like to be able to throttle the bandwidth on this connection. Also, if there are any extra pitfalls to doing this in cron, please warn me. (I have already learned some of the cron pitfalls - I have duplicity working okay with ssh-agent in cron using sshfs instead, but I can't easily throttle that without learning tc it seems.)

1

Manual page explains the how you can modify this behavior, so it will use something different than paramiko:

SCP/SFTP access

scp://.. or

sftp://user[:password]@other.host[:port]/[relative|/absolute]_path

defaults are paramiko+scp:// and paramiko+sftp:// alternatively try pexpect+scp://, pexpect+sftp://, lftp+sftp:// See also --ssh-askpass, --ssh-options and *A NOTE ON SSH BACKENDS**.

You should be able to use

duplicity local-dir pexpect+sftp://faraway//remote-dir/

which should fall back to the ssh backend itself.

I'd really like to be able to throttle the bandwidth on this connection.

Again, manual page for sftp speaks about limitation of the transfer speeds:

-l limit

Limits the used bandwidth, specified in Kbit/s.

You can specify that using --ssh-options to pass it to duplicity:

duplicity --ssh-options="-l 100" local-dir pexpect+sftp://faraway//remote-dir/
  • Thanks! I did read the man page, and even the section on ssh backends - but obviously not carefully enough. I assumed pexpect was some fancy variation on paramiko rather than the default ssh. (I did know how to throttle regular ssh, but not paramiko's version. – Steve Petersen Jan 28 '17 at 15:22
  • It's still not working though - maybe pexpect doesn't read ssh's config file? – Steve Petersen Jan 28 '17 at 15:22
  • Actually it works fine in the CLI once I figured out my duplicity version of wants --ssh-backend pexpect rather than pexpect+sftp in the url. But it does not work in cron - though as I say I had it reading the ssh agent info well enough for sshfs before. – Steve Petersen Jan 28 '17 at 16:04
  • Oops again. Just a typo in the cron script. All working now. Thanks again. I'll try more strategies before multi-commenting next time. – Steve Petersen Jan 28 '17 at 16:32
  • pexect (pexpect.readthedocs.io/en/stable) is the most well known Python module for implementing "expect" like features (TCL/expect). It enables one to automate interactions with pseudo-terminal devices. – Jim Dennis Oct 15 '18 at 20:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.