Fabric ssh请求密码,但调试输出中没有密钥失败

时间:2017-04-11 12:17:02

标签: python python-3.x ssh fabric paramiko

我正在尝试使用Fabric3自动ssh到Linux机器而不从我的Windows 7 PC输入密码。我正在使用我用.ppk文件中的puttygen生成的openssl密钥,我通常用它来使用PuTTY登录。我的python脚本如下:

paramiko.common.logging.basicConfig(level=paramiko.common.DEBUG) #Added for ssh key debugging

env.host_string = "#.#.#.#" 
with settings(user='root', key_filename='C:\\Users\\me\\Documents\\My_id.pub'):  
    run('ifconfig eth1', stderr=output)

输出(带调试)是:

C:\Users\me\Documents\Testing\TestRig\python_scripts>python ssh_login.py
[#.#.#.#] run: ifconfig eth1
DEBUG:paramiko.transport:starting thread (client mode): 0x3087070
DEBUG:paramiko.transport:Local version/idstring: SSH-2.0-paramiko_2.1.2
DEBUG:paramiko.transport:Remote version/idstring: SSH-2.0-OpenSSH_5.1p1 Debian-5
INFO:paramiko.transport:Connected (version 2.0, client OpenSSH_5.1p1)
DEBUG:paramiko.transport:kex algos:['diffie-hellman-group-exchange-sha256', 'diffie-hellman-group-exchange-sha1', 'diffi
e-hellman-group14-sha1', 'diffie-hellman-group1-sha1'] server key:['ssh-rsa', 'ssh-dss'] client encrypt:['aes128-cbc', '
3des-cbc', 'blowfish-cbc', 'cast128-cbc', 'arcfour128', 'arcfour256', 'arcfour', 'aes192-cbc', 'aes256-cbc', 'rijndael-c
bc@lysator.liu.se', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr'] server encrypt:['aes128-cbc', '3des-cbc', 'blowfish-cbc',
'cast128-cbc', 'arcfour128', 'arcfour256', 'arcfour', 'aes192-cbc', 'aes256-cbc', 'rijndael-cbc@lysator.liu.se', 'aes128
-ctr', 'aes192-ctr', 'aes256-ctr'] client mac:['hmac-md5', 'hmac-sha1', 'umac-64@openssh.com', 'hmac-ripemd160', 'hmac-r
ipemd160@openssh.com', 'hmac-sha1-96', 'hmac-md5-96'] server mac:['hmac-md5', 'hmac-sha1', 'umac-64@openssh.com', 'hmac-
ripemd160', 'hmac-ripemd160@openssh.com', 'hmac-sha1-96', 'hmac-md5-96'] client compress:['none', 'zlib@openssh.com'] se
rver compress:['none', 'zlib@openssh.com'] client lang:[''] server lang:[''] kex follows?False
DEBUG:paramiko.transport:Kex agreed: diffie-hellman-group1-sha1
DEBUG:paramiko.transport:Cipher agreed: aes128-ctr
DEBUG:paramiko.transport:MAC agreed: hmac-md5
DEBUG:paramiko.transport:Compression agreed: none
DEBUG:paramiko.transport:kex engine KexGroup1 specified hash_algo <built-in function openssl_sha1>
DEBUG:paramiko.transport:Switch to new keys ...
DEBUG:paramiko.transport:Adding ssh-rsa host key for #.#.#.#: b'23df3f11b9dc46423a03afd08bae8cf9'
[#.#.#.#] Login password for 'root': 

最后一行提示输入密码。我不要那个;这就是我想要解决的问题。在SO上看一些类似的问题,paramiko调试输出通常会说“认证失败”。但是,我在这里看不到。

我最好的猜测是公钥是可以的,但是我在Python脚本中缺少一些额外的设置。

0 个答案:

没有答案
相关问题