1

I'm trying to understand why SSH proxycommand isn't working. I have a SSH config file in a custom location as below.

vagrant@ansible:~$ cat ~/.ssh/cml-config
Host mgmt-lxc
  HostName 10.17.238.146
  IdentityFile ~/.ssh/id_rsa
  User Rod

Host 10.255.0.*
  ProxyCommand ssh -W %h:%p mgmt-lxc
vagrant@ansible:~$

I can SSH to the jumphost and from there to another device.

vagrant@ansible:~$ ssh -F ~/.ssh/cml-config mgmt-lxc
Rod@mgmt-8Fe5bN$ ssh cisco@10.255.0.47
Warning: Permanently added '10.255.0.47' (RSA) to the list of known hosts.

            ,,,,,
            /'''\
           ( o o )
      -oOOO--(_)--OOOo-------------------------------------------
       Router: Core-1
                      Secured system for authorized users only.
       .oooO          Unauthorized access is strictly prohibited.
        (   )   Oooo. All activities may be logged and monitored.
      ---\ (----(   )--------------------------------------------
          \_)    ) /
                (_/
Password:

However when I attempt to SSH directly to 10.255.0.47 using the custom SSH key I get an error.

vagrant@ansible:~$ ssh -F ~/.ssh/cml-config cisco@10.255.0.47
ssh: Could not resolve hostname mgmt-lxc: Name or service not known
ssh_exchange_identification: Connection closed by remote host
vagrant@ansible:~$

I'm running Ubuntu Xenial64.

0

Add -F /the/path/to/.ssh/cml-config in your ssh -W command used as ProxyCommand (I am not sure the ~ path will work here, so try it and maybe use the full path).

Because otherwise your ssh interactive command will run ssh -W ... mgmt-lxc but then it will have no configuration file to read to discover that mgmt-lxc is not a true name resolving but a nickname you used in your configuration file.

Or add mgmt-lxc in /etc/hosts or equivalent with its IPv4 address 10.17.238.146.

Or put everything in .ssh/config instead, as it is the default and will simplify your usage.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

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