2

I'm trying to use intermediate machine to connect to a remote host but I'm doing something wrong and not sure what.

I have added to my intermediate box /etc/ssh/sshd_config following lines:

Match User deploy
PermitOpen  any
AllowTcpForwarding yes
ForceCommand echo 'This account can only be used for deployments'

I can ssh from that intermediate box onto the target system no problem but I was hoping to be able to just execute a command like one below to connect via my proxy box:

ssh deploy@dev-linux-03 -W TARGET_IP:22

But I'm getting different response:

 SSH-2.0-OpenSSH_4.3

 Protocol mismatch.

Anything obvious I've missed?

Mahakala
  • 121

1 Answers1

2

You specified the command incorrectly. The correct way to type the command would be like this:

ssh -o ProxyCommand='ssh -W %h:%p user@intermediate-host' user@target-host

If you need this frequently, you can add it to ~/.ssh/config like this:

Host target-host
    User user
    ProxyCommand ssh -W %h:%p user@intermediate-host

Then you only need to type ssh target-host to connect.

kasperd
  • 31,086