2

In order to access a certain machine I need to get through a proxy and then via a jumphost, before I'm at the desired location.

For this I'm using a config file like this:

### jumphost
Host jmp
  HostName xxx.xxx.xxx.xxx:port
  User user
  ProxyCommand corkscrew proxy.name.com port %h %p

### box
Host box
  HostName xxx.xxx.xxx.xxx
  User user
  ProxyCommand ssh mgmtbox netcat -w 120 %h %p

This works perfectly fine as long as the config file is in its set location. However, if I want to specify this config file with the -F flag ("ssh -F configfile box"), I get the following error:

ssh: Could not resolve hostname jmp: Name or service not known

The problem starts only with the second host. If I use "ssh -F configfile jmp" the command works fine.

I'm a bit lost here, since the config file works perfectly fine until it is used via the -F flag. Any ideas?

2 Answers 2

2

This works perfectly fine as long as the config file is in its set location. However, if I want to specify this config file with the -F flag ("ssh -F configfile box"), I get the following error:

The problem is that while running proxy command, you don't specify the configuration location. It is completely unrelated ssh instance and therefore it does not know the hostname.

Using

ProxyCommand ssh -F configfile mgmtbox netcat -w 120 %h %p

will make it work for you. Also the other thing pointed out in the other answer applies.

0
1

I think this is the problem

HostName xxx.xxx.xxx.xxx:port

I think it should be

HostName xxx.xxx.xxx.xxx
Port port

The ssh config HostNameparameter takes a hostname, not a hostname:port

1
  • Apparently ip:port works fine in the config file. I just tried it without and can't connect anymore.
    – su_li
    Mar 21, 2017 at 11:02

You must log in to answer this question.

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