Today I was trying to figure out how to ssh into one system, and then automatically ssh into another system. The logical way:

ssh user@outside_host "user@inside_host"

wasn’t working. The logs on both inside and outside hosts would show a connection, but I would get no prompt. I tried typing a command, hit enter, and saw the output of the command! OK, that’s odd.

So, I hit #openssh and posted my problem. User dmlloyd and I started dialoging and figured out that a TTY wasn’t being allocated. OK, why not. AH! openssh’s -t parameter to the rescue. So this does work:

ssh -t user@outside_host "ssh user@inside_host"

NOTE: Yes, I know I could just set up port forwarding or DNAT firewall rules, but the inside hosts don’t need any access from the outside at all, so the chained SSH method was much better.


comments powered by Disqus