Error reading SSH protocol banner
See original GitHub issueI’m hoping someone here can guide me in the right direction to solve a looping error.
I have some python:
for name in instanceNames:
print(f'\nChecking {name} ...')
c = Connection(name)
try:
print('Exec hostname')
r = c.run('hostname', warn=True)
print(f'{r}')
except:
print('SSH session error')
Runs along fine until it hits a particular system and then:
Exception: Error reading SSH protocol banner
Traceback (most recent call last):
File "/root/.local/lib/python3.7/site-packages/paramiko/transport.py", line 2211, in _check_banner
buf = self.packetizer.readline(timeout)
File "/root/.local/lib/python3.7/site-packages/paramiko/packet.py", line 380, in readline
buf += self._read_timeout(timeout)
File "/root/.local/lib/python3.7/site-packages/paramiko/packet.py", line 622, in _read_timeout
raise socket.timeout()
_socket.timeout
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/root/.local/lib/python3.7/site-packages/paramiko/transport.py", line 2039, in run
self._check_banner()
File "/root/.local/lib/python3.7/site-packages/paramiko/transport.py", line 2216, in _check_banner
"Error reading SSH protocol banner" + str(e)
paramiko.ssh_exception.SSHException: Error reading SSH protocol banner
Exception: Error reading SSH protocol banner
Traceback (most recent call last):
File "/root/.local/lib/python3.7/site-packages/paramiko/transport.py", line 2211, in _check_banner
buf = self.packetizer.readline(timeout)
File "/root/.local/lib/python3.7/site-packages/paramiko/packet.py", line 380, in readline
buf += self._read_timeout(timeout)
File "/root/.local/lib/python3.7/site-packages/paramiko/packet.py", line 622, in _read_timeout
raise socket.timeout()
_socket.timeout
During handling of the above exception, another exception occurred:
...
This goes on until I CTRL-C, after which all other host items throw an exception.
I don’t really care at the moment about the banner exception on that particular host (I will deal with that later) but for now I’d like to avoid the retries and subsequent failures. Any tips?
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Paramiko : Error reading SSH protocol banner - Stack Overflow
It could be network congestion, faulty switches, etc... but usually it means that the target server is bogged down or its sshd has...
Read more >Message: Error Reading SSH Protocol Banner
Message: Error Reading SSH Protocol Banner ... Nodegrid allows 10 ssh connections enqueued during protocol negotiation phase. So if you launch more than...
Read more >Error reading SSH protocol banner[Errno 104] Connection ...
I'm working on a CircleCi job running a configuration on an EC2 instance. The problem is that the ansible could not run the...
Read more >Error reading SSH protocol banner - Google Groups
If that doesn't work, the specific error you're looking at, "error reading ssh protocol banner", sounds more like you're ending up on the...
Read more >Bug #14500: "Error reading SSH protocol banner" in rados ...
This was due to conflicting entries for the machines in my known_hosts file and once they were removed the operation succeeded. After my...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @Gary-Armstrong,
It looks like it might be worth passing banner_timeout to Connection.connect_kwargs and seeing if that helps.
A quick example (untested):
A couple of people appear to have had a similar issue to yours before, and adding a reasonable
banner_timeout
appears to have helped. Let me know how you get on!Cheers, David
In case this helps anyone like me who wasn’t creating a
Connection
manually, it was just through the magic of fabric:you can create a
fabric.yml
with a bunch of config settings includingbanner_timeout
, and put it in the dir you’re callingfab
from, e.g.and you can confirm that the settings are being used by adding this in your imports to turn on paramiko debug logging: