Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Possible Duplicate:
Forward SSH traffic through a middle machine.

I am looking to get an interactive ssh session on a remote machine, but must login via a gateway.

For example, right now I do the following:

@local % ssh <user>@<gateway>

@gateway % ssh <user>@<remote>

Is it possible to achieve the same thing in a single command from my local machine? I have tried:

@local % ssh <user>@<gateway> 'ssh <user>@<remote>`

From the output i am indeed able to login, but do not get an interactive session. I took inspiration for this attempt from using ssh to run a command remotely.

share|improve this question

marked as duplicate by Gilles, random Sep 6 '10 at 21:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
    
Thanks - sorry I didn't find that one when searching earlier. –  dtlussier Sep 6 '10 at 21:12

1 Answer 1

up vote 1 down vote accepted

One way:

On your "gateway"...

vi ~/.ssh/config
Host remote
   ProxyCommand ssh -C gateway '/usr/bin/nc <remote.ip.address> 22'

On "local"...

$ ssh -t user@gateway 'ssh user@remote'
share|improve this answer
    
Thanks - I'd rather not make changes to the gateway machine as I have limited ability to access it beyond ssh login. I am not expert in the ways of modifying ssh config files so for me I'd rather make changes locally so that I can easily undo them in the event they don't work. A local solution is suggested in superuser.com/questions/107679/… as suggested by Gilles. –  dtlussier Sep 6 '10 at 21:14

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