0

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.

dtlussier
  • 2,195

1 Answers1

4

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'
Matt
  • 406