Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/346.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Fabric--连接到~/.ssh/config中的主机仍会提示输入密码短语_Python_Ssh_Fabric - Fatal编程技术网

Python Fabric--连接到~/.ssh/config中的主机仍会提示输入密码短语

Python Fabric--连接到~/.ssh/config中的主机仍会提示输入密码短语,python,ssh,fabric,Python,Ssh,Fabric,我正在使用fabric.user\u ssh\u config=True,我的ssh配置如下所示: Host server_vm1.domain.com IdentityFile ~/.ssh/id_rsa_uiuc IdentitiesOnly yes User t2 但是,每次连接到这台机器时,都会提示我输入密码(就像它正在查看我的标准id\u rsa文件,它确实需要密码): [server_vm1.domain.com]私钥的

我正在使用
fabric.user\u ssh\u config=True
,我的ssh配置如下所示:

Host    server_vm1.domain.com
        IdentityFile    ~/.ssh/id_rsa_uiuc
        IdentitiesOnly  yes
        User t2
但是,每次连接到这台机器时,都会提示我输入密码(就像它正在查看我的标准
id\u rsa
文件,它确实需要密码):

[server_vm1.domain.com]私钥的密码短语:


当我尝试执行
fabric.api.put('ds.tar','/root/test')
时,就会发生这种情况。
用户t2
与我的本地用户(从那里运行结构脚本)不同。我可以直接从终端进行ssh,无需任何提示。

您可以尝试
sshpass
我认为这对我没有帮助。问题是它使用了错误的rsa密钥。我的标准
id\u rsa
文件确实需要密码。配置中应使用的一个结构(id_rsa_uiuc)没有。请尝试通过后端或使用shell脚本(从Server1到Server2和Server2到Server1)相互交换rsa密钥。因此,您可以不使用密码通过ssh。