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

David Brodbeck gull at
Mon Dec 20 20:18:01 UTC 2010

On Fri, Dec 3, 2010 at 4:43 PM, Josh Suid <joshsuid at> wrote:
> 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 ?

At what point are you seeing timeouts?

I've found many home routers time out idle TCP sessions quite quickly,
so if it's the first jump, you may find enabling ClientAliveInterval
helps.  I find a setting of 300 seconds (5 minutes) is frequent enough
to keep most routers happy.

> 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)

Normally when you execute a command over SSH it doesn't allocate a
pseudo-tty, like it normally will for an interactive session.  You
might try passing the -t command to force allocation of a ptty.

Another option would be to use ssh -L to create a tunnel from one host
to another, then running ssh over that tunnel.  This would also work
with scp.  You may run into problems with host keys, though.

More information about the freebsd-questions mailing list