使用 Fabric 连接到 aws-ec2 时禁用密码提示
Disable password prompt when connecting to aws-ec2 with 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:
知道要做什么吗?我不想被提示输入密码。
谢谢,
以太坊
请将 paramiko
版本更新到最新的 2.1。
Ubuntu 16 有 sshd
的更新版本,paramiko
1.1 不支持。
在连接 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:
知道要做什么吗?我不想被提示输入密码。
谢谢, 以太坊
请将 paramiko
版本更新到最新的 2.1。
Ubuntu 16 有 sshd
的更新版本,paramiko
1.1 不支持。