ssh interactive session, through intermediate hosts ... problems ...

Josh Suid joshsuid at
Sat Dec 4 00:56:31 UTC 2010

I connect to some systems via a series of ssh "jumps" - something like:

# ssh user at host

host~/ # ssh user at host2

host2~/ # ssh user at host3

host3~/ #  (do some work)

This is working well for me and does what I want it to.  However, there are
some things I'd like to do that are not working well for me...

First, where on the ssh client command line (see above) can I specify a more
liberal timeout value ?  Since my interactive session has three or more layers
of host between it, the whole thing falls apart if even one link slows down a
bit...  how can I make my ssh sessions more tolerant to timeouts ?

Alternatively, since I control all of these systems, is there a global
FreeBSD setting (sysctl ?) that would do this ?

Second, how can I construct this session with just a single command ?  When I
try this:

ssh user at host ssh user at host2 ssh user at host3

I get this error:

# ssh user at host ssh user at host2
Pseudo-terminal will not be allocated because stdin is not a terminal.
Permission denied (publickey,keyboard-interactive).

Is there a way to build this tunnel with a single command ? (an ssh command,
run over an ssh command, run over an ssh command)

Finally, is there a way to scp a file over intermediate hosts ?  That is to
say, I want to scp the file:  user at host:/some/file to myself, but I want
the ssh session to go through hosts X and Y first ... there must be a way
to do this where you pipe the output of scp over ssh to ... head spinning...

Thanks a lot.


More information about the freebsd-questions mailing list