且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Python - Paramiko - 不兼容的 ssh 服务器

更新时间:2023-12-05 14:13:46

您应该检查您的 SSH 服务器 (sshd_config, key: MACs) 上是否有任何这些 MACs 算法:

  • HMAC-SHA1
  • HMAC-MD5
  • HMAC-SHA1-96
  • HMAC-MD5-96.

它们需要以便 Paramiko 连接到您的 SSH 服务器.

I have an error on a script I have wrote since few months, it worked very good with a raspberry pi, but now with an orange pi I have this:

>>> import paramiko
>>> transport = paramiko.Transport("192.168.2.2", 22)
>>> transport.connect(username = "orangepi", password = "my_pass")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/paramiko/transport.py", line 978, in connect
    self.start_client()
  File "/usr/lib/python2.7/dist-packages/paramiko/transport.py", line 406, in start_client
    raise e
paramiko.ssh_exception.SSHException: Incompatible ssh server (no acceptable macs)

I can connect in console with ssh without problem.

Somebody has an idea ?

You should check if any of those MACs algorithms are available on your SSH server (sshd_config, key: MACs) :

  • HMAC-SHA1
  • HMAC-MD5
  • HMAC-SHA1-96
  • HMAC-MD5-96.

They are needed in order for Paramiko to connect to your SSH server.