2

I am on macOS Sierra, and my SSH version is : OpenSSH_7.5p1, OpenSSL 1.0.2l 25 May 2017

I have this content in my .ssh/config :

Host db
  User user
  HostName 192.168.1.111
  ProxyCommand ssh user@db -W %h:%p

Host website
  User user
  HostName 192.168.1.100
  ProxyCommand ssh user@Website -W %h:%p

I also have a server with a public IP, that has direct connection with these two servers, I want to forward my SSH connection through this public server to my private servers (db and website).

When I use this command:

ssh user@db -W %h:%p

I get this error:

Bad stdio forwarding specification '%h:%p'

Now, what should I do to solve this problem and connect my macOS host to my private servers?

  • I don't understand why you have a ProxyCommand entry and you also add -W %h:%p on the command line. Shouldn't you pick one or the other and not both? – bmike Mar 24 '18 at 17:05
2

Your config file as well as the command are wrong.

The ProxyCommand line should contain the JumpHost's user/hostname but not the final destination.

Config file:

Host db
  User dbuser
  HostName 192.168.1.111 #db host name/IP
  ProxyCommand ssh user_public_server@public_server -W %h:%p

Host website
  User websiteuser
  HostName 192.168.1.100 #website host name/IP
  ProxyCommand ssh user_public_server@public_server -W %h:%p

The command is then simply ssh db or ssh website because the user friendly Host's name (e.g. db) as defined in the config file is expanded to the HostName/IP (e.g. 192.168.1.111).

  • still same error – Jafar.A Aug 27 '17 at 5:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .