Paramiko : Error reading SSH protocol banner

前端 未结 3 671
滥情空心
滥情空心 2020-12-09 07:04

Recently, I made a code that connect to work station with different usernames (thanks to a private key) based on paramiko.

I never had any issues with it, but today,

3条回答
  •  暖寄归人
    2020-12-09 08:03

    Adding to the answers above, suggesting to edit transport.py: you don't have to do that anymore.


    Since Paramiko v. 1.15.0, released in 2015, (this PR, to be precise) you can configure that value when creating Paramiko connection, like this:

    client = SSHClient()
    client.connect('ssh.example.com', banner_timeout=200)
    


    In the current version of Paramiko as of writing these words, v. 2.7.1, you have 2 more timeouts that you can configure when calling connect method, for these 3 in total (source):

    • banner_timeout - an optional timeout (in seconds) to wait for the SSH banner to be presented.
    • timeout - an optional timeout (in seconds) for the TCP connect
    • auth_timeout - an optional timeout (in seconds) to wait for an authentication response.

提交回复
热议问题