我使用paramiko已经有一段时间了,一切正常,但是当我离开测试环境时,在打开ssh会话时出现了这个错误paramiko.ssh_exception.SSHException: Incompatible ssh server (no acceptable macs)
跟踪错误后,我注意到在远程服务器上,我的/etc/ssh/sshd_config文件中缺少一些条目。我的两个设置都没有列出这些Mac:HMAC-SHA1型
HMAC-MD5型
HMAC-SHA1-96型
HMAC-MD5-96型
然而,它在其中一个工作,而不是在另一个。这是什么原因?我没有在其中任何一个中保存rsa密钥(远程服务器不允许写入)。
远程服务器的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.pyclass 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)
我引用的链接: