2

I have an .ssh/config:

Host host01 host01.in.mynet
     User           costello
     HostName       1.2.3.4
     Port           22222

Which is working fine with plain ssh:

ssh host01
costello@host01 ~ »

But fabric is not using that config:

$ fab deploy:host=host01

[host01] Executing task 'deploy'

Fatal error: Low level socket error connecting to host host01 on port 22: Connection refused (tried 1 time)

Underlying exception:
    Connection refused

Aborting.

Why is fabric not using the ssh's configuration? I would really like to avoid duplicating the configuration for fabric or, even worse, change the ssh port of my server.

blueFast
  • 41,341
  • 63
  • 198
  • 344
  • I suspect this has to do with the fact that Fabric uses the `paramiko` library for ssh, rather than relying on the command line `ssh` client. I see that paramiko has some support for parsing the ssh configuration file, but I'm not sure if it supports all the available directives or not. – larsks Aug 14 '15 at 14:29
  • You need to specify the port for `fab`. In the error you see it is connecting to port 22 instead of 22222 as you have in your config. – Jakuje Aug 14 '15 at 14:40
  • @Jakuje: I know. And that is exactly what I want to avoid. I have a fully configured ssh environment, and I want fab to use it. I can pass the fqdn of the host, the port and the user to fab, but why should I? It is already in the .ssh/config. Dear fab: please just use it! – blueFast Aug 14 '15 at 17:21
  • @larsks: neither do I, but it seems a bit strange if it does not. I mean: isn't paramiko using the ssh libraries behind the scenes? It could also use the parsing of .ssh/config, but what do I know. – blueFast Aug 14 '15 at 17:25
  • 2
    possible duplicate of [Connecting to a host listed in ~/.ssh/config when using Fabric](http://stackoverflow.com/questions/3077281/connecting-to-a-host-listed-in-ssh-config-when-using-fabric) – Jakuje Aug 15 '15 at 06:23

0 Answers0