I've been using paramiko for a while and everything has worked as expected, but when I moved out of my testing environment, I got this error when opening an ssh session
paramiko.ssh_exception.SSHException: Incompatible ssh server (no acceptable macs)
After tracing down the error, I noticed that on my remote server, I'm missing some entries in my /etc/ssh/sshd_config
file. Neither of my setups have these MACs listed:
However, it works in one and not the other. What could be causing this? I don't have rsa keys saved in either one (remote server does not allow for writing).
Remote server's sshd_config
#
# Allow Ciphers and MACs
#
Ciphers aes256-ctr,aes192-ctr,aes128-ctr,arcfour256,arcfour128
MACs umac-64@openssh.com,hmac-ripemd160,hmac-sha2-512,hmac-sha2-256
RemoteAccess.py
class RemoteAccess():
def __init__(self, host="abc123", username="abc", password="123"):
self.name = host
self.client = paramiko.SSHClient()
self.client.load_system_host_keys()
self.client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
self.client.connect(host, username=username, password=password)
Links I've referenced:
Python - Paramiko - incompatible ssh server
paramiko Incompatible ssh peer (no acceptable kex algorithm)
答案 0 :(得分:3)
出于某种原因,paramiko1.15.1会抱怨不兼容的MAC。 paramiko1.16.0没有。通过将1.16.0文件复制到其安装位置来解决此问题。
/usr/lib/python2.7/site-packages/paramiko
paramiko版本的更改日志可以在这里找到: http://www.paramiko.org/changelog.html