[Error resolution] paramiko.ssh_exception.SSHException: Error reading SSH protocol banner setting

Error message
In the morning, my colleague in the data group told me that there were several programs reporting errors. After checking the log, the error message was found:

paramiko.ssh_exception.SSHException: Error reading SSH protocol banner

After a search, it was revealed that the error was caused by the banner_TIMEOUT default setting being too short, only 15s.
Error analysis
See the transport code under Paramiko library. Py:

class Transport(threading.Thread, ClosingContextManager):
        self.banner_timeout = 15
        # how long (seconds) to wait for the handshake to finish after SSH

Reset the banner_TIMEOUT property value
Most of the methods on the Internet is to modify the source code, reinstall, feel a little trouble. I’m going to reset the properties in the code.

transport = paramiko.Transport((self.host, self.port))
print(transport.banner_timeout)
transport.banner_timeout = 30
print(transport.banner_timeout)

After testing, the two printed property values are different, indicating that the property is set successfully and the problem is solved.

Reproduced in: https://www.cnblogs.com/everfight/p/paramiko_ssh_exception.html

Read More: