使用Fabric连接到aws-ec2时禁用密码提示

时间:2017-05-17 20:47:22

标签: ssh amazon-ec2 fabric

当与Fabric连接时,我被提示输入密码,而当手动连接时,我什么也得不到 - 只是连接。

你知道这个问题是什么吗?

我正在使用基于ubuntu 16的aws ec2实例。 在我的电脑上,我正在运行" fab test"用于运行以下代码:

from fabric.api import *
import paramiko
paramiko.util.log_to_file("fab.log")
env.key_filename = '~/.ssh/etay-new.pem'
env.hosts = ['my.real-ip.trust.me']
env.user = 'ubuntu'

def test():
    run('ls');

我已经检查过sshd_config,我确实将ChallengeResponseAuthentication和PasswordAuthentication设置为NO。

fab.log:

DEB [20170518-00:12:30.497] thr=1   paramiko.transport: starting thread (client mode): 0x558bbe50L
INF [20170518-00:12:30.742] thr=1   paramiko.transport: Connected (version 2.0, client OpenSSH_7.2p2)
DEB [20170518-00:12:30.969] thr=1   paramiko.transport: kex algos:['curve25519-sha256@libssh.org', 'ecdh-sha2-nistp256', 'ecdh-sha2-nistp384', 'ecdh-sha2-nistp521', 'diffie-hellman-group-exchange-sha256', 'diffie-hellman-group14-sha1'] server key:['ssh-rsa', 'rsa-sha2-512', 'rsa-sha2-256', 'ecdsa-sha2-nistp256', 'ssh-ed25519'] client encrypt:['chacha20-poly1305@openssh.com', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'aes128-gcm@openssh.com', 'aes256-gcm@openssh.com'] server encrypt:['chacha20-poly1305@openssh.com', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'aes128-gcm@openssh.com', 'aes256-gcm@openssh.com'] client mac:['umac-64-etm@openssh.com', 'umac-128-etm@openssh.com', 'hmac-sha2-256-etm@openssh.com', 'hmac-sha2-512-etm@openssh.com', 'hmac-sha1-etm@openssh.com', 'umac-64@openssh.com', 'umac-128@openssh.com', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-sha1'] server mac:['umac-64-etm@openssh.com', 'umac-128-etm@openssh.com', 'hmac-sha2-256-etm@openssh.com', 'hmac-sha2-512-etm@openssh.com', 'hmac-sha1-etm@openssh.com', 'umac-64@openssh.com', 'umac-128@openssh.com', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-sha1'] client compress:['none', 'zlib@openssh.com'] server compress:['none', 'zlib@openssh.com'] client lang:[''] server lang:[''] kex follows?False
ERR [20170518-00:12:30.969] thr=1   paramiko.transport: Exception: Incompatible ssh peer (no acceptable kex algorithm)
ERR [20170518-00:12:30.969] thr=1   paramiko.transport: Traceback (most recent call last):
ERR [20170518-00:12:30.969] thr=1   paramiko.transport:   File "/usr/lib/python2.7/dist-packages/paramiko/transport.py", line 1585, in run
ERR [20170518-00:12:30.969] thr=1   paramiko.transport:     self._handler_table[ptype](self, m)
ERR [20170518-00:12:30.970] thr=1   paramiko.transport:   File "/usr/lib/python2.7/dist-packages/paramiko/transport.py", line 1664, in _negotiate_keys
ERR [20170518-00:12:30.970] thr=1   paramiko.transport:     self._parse_kex_init(m)
ERR [20170518-00:12:30.970] thr=1   paramiko.transport:   File "/usr/lib/python2.7/dist-packages/paramiko/transport.py", line 1779, in _parse_kex_init
ERR [20170518-00:12:30.970] thr=1   paramiko.transport:     raise SSHException('Incompatible ssh peer (no acceptable kex algorithm)')
ERR [20170518-00:12:30.970] thr=1   paramiko.transport: SSHException: Incompatible ssh peer (no acceptable kex algorithm)
ERR [20170518-00:12:30.970] thr=1   paramiko.transport: 

知道该怎么办?我不想提示输入密码。

谢谢, Etay

1 个答案:

答案 0 :(得分:2)

请将paramiko版本更新为最新的2.1。

Ubuntu 16的更新版sshd paramiko 1.1不支持。