Fabric not using the correct key

In my fabfile, I have set env.use_ssh_config to True. Whenever I run the fabfile, it will get the correct hostname and user from the ssh config, but not the correct key. It will go though my keys(all stored in ~/.ssh/) at random, requiring me to enter the passphrase for all of them, till it gets to the correct key.

It’s only fabric that gives me this problem. Running scp as a local command in the fabfile uses the correct key.

Host example
    HostName example.com
    User elssar
    IdentityFile ~/.ssh/id_example
    PreferredAuthentications publickey

Entries in my ssh config look like this.

I’m, using Fabric version 1.10.1 and Paramiko version 1.14.1.

Edit – There is a related open issue in the fabric repository – https://github.com/fabric/fabric/issues/1282

Download fabric.not.using.the.correct.key.zip
Direct Link


Download fabric.not.using.the.correct.key.zip


Download fabric.not.using.the.correct.key.zip


Both comments and pings are currently closed.

Comments are closed.