Open phpguru opened 7 years ago
Fabric/paramiko can also use ssh-agent. If you have ssh-agent running correctly, you can ssh-add $keyfile
and then fabric/parmiko will use it. (This also helps for "new format" bcrypt-protected keys, which paramiko can't handle on its own.)
Not sure why it'd hang on env.key_filename
unless the pem file is causing Paramiko to freak out (possible; I believe we have open tickets about certificate support).
@ploxiln is right that you can use an agent for this.
Relatedly, you can disable the id_rsa loading (if desirable; also it's unclear if in your workaround, id_rsa.pub
is a public key variant of your secureserver.pem
or a wholly separate secret, I'm assuming the latter) via env.no_keys = True
(IIRC; it'll be listed in the env docs.)
Hello, I meet the same issue by using windows. fabric version 1.14.0
fabfile.py:
from fabric.api import *
def test():
run('pwd')
Fabric hangs when I run:
fab -A -H host_path test
after ssh-add my id_rsa in git-bash.
I think it's maybe because windows have not keychain like Mac OS, ssh-add was just useful only in the same bash console.
I found a solution which was also written by @bitprophet in 2011 https://github.com/fabric/fabric/issues/72 code: local("ssh -A %s '%s'" % (env.host_string, real_command))
If someone finds the other solutions please tell me. thx~
Running in Git-bash on Windows 12 Server.
Fabfile
Command:
fab -A -H secure.server.com set_debug getdate
Error:
DEBUG:paramiko.transport:Trying discovered key 98b9343a1be86eb29763fc1f22c9b9a8 in C:\Users\phpguru/.ssh/id_rsa
If I add
then when I run the command, Fabric just hangs.
DEBUG:paramiko.transport:Switch to new keys ... DEBUG:paramiko.transport:Adding ssh-rsa host key for secure.server.com: 478f2730e199684dc7c58058492984f6
In short, I cannot for the life of me figure out how to get Fabric to use a specific SSH key on Windows.
My only workaround has been to add id_rsa.pub to ~/.ssh/authorized_keys on all boxes I want to manage with Fabric.