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:
- ansible Q&A: Failed to connect to the host via ssh: ssh_exchange_identification and Authentication or per
- [Solved] Error getting ssh command ‘exit 0‘ : ssh command error:
- Python module learning-Paramiko-Use python to throw an exception: Authentication failed.
- ssh port forwarding
- Workbench Could not connect the SSH Tunnel Authentication error
- Gt Report Error ssh:connect to host github.com port 22
- Solve ssh error: shell request failed on channel 0
- SSH appears warning: remote host identification has changed!
- Windows subsystem Ubuntu 18.04 solves SSH problem
- SSH Remote ulimit does not work
- Cloning failed using an SSH key for authentication
- The solution to the problem that the virtual machine and the host SSH can’t connect on vmvare
- SSH write failed broken pipe
- Ubuntu starts or restarts SSH service
- About Using SSH connection for Linux server
- Solutions to remote or adding SSH key errors
- Solve the problem of keyboard interactive authentication with the SSH2 server failed
- Make the root user login through SSH and report the error of “permission denied, please try again”
- Mobaxterm connects to Ubuntu server through SSH network error: software caused connection abort
- SSH connection to MAC server shows No route to host solution