Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

paramiko.SSHException: Error reading SSH protocol banner

I am using Paramiko and trying to connect to my SFTP server. Here is the code I wrote:

class SFTPUploader:
    def __init__(self, host, username, password, port):
        transport = paramiko.Transport((host, port))
        print transport
        transport.connect(username = username, password = password)
        self.sftp = paramiko.SFTPClient.from_transport(transport)

I can connect to my server from the terminal. This thread didn't help since our scenario is different.

like image 988
masnun Avatar asked Mar 01 '12 17:03

masnun


1 Answers

That error is generated when paramiko doesn't receive a protocol banner, or the server sends something invalid. If the server is otherwise working correctly, this may be due to some network restrictions.

You can use -vvv as an option to the openssh client to get more information about how it's connecting, and you can get the actual banner easily using netcat or telnet on port 22. The banner should start with 'SSH-', or paramiko will return the above error immediately.

like image 190
JimB Avatar answered Oct 11 '22 06:10

JimB