Paramiko: Whats the difference between various timeouts?

Viewed 32

We have multiple timeouts in the Paramiko library, which seems confusing on which to set when. The doc tried to describe them, but I don't understand their use cases. Like, when should I use one over the other?

Connect method

  1. timeout: an optional timeout (in seconds) for the TCP connect
  2. banner_timeout: an optional timeout (in seconds) to wait for the SSH banner to be presented.
  3. auth_timeout: an optional timeout (in seconds) to wait for an authentication response.

Exec_command method

  1. timeout: set command’s channel timeout. See Channel.settimeout
1 Answers

SSHClient.connect method:

  • timeout – TCP connection opening timeout (but maybe also for some other socket operations). But also timeout for SSH negotiation. Default is no timeout.
  • banner_timeout – After TCP connection is opened, how long to wait for the server to anything (that is SSH banner). Default is 15 seconds.
  • auth_timeout – How long to wait for an authentication response (that imo self-explanatory). Default is 30 seconds.

SSHClient.exec_command method:

  • timeout – How long to wait for "exec" channel to open. And subsequently timeout for each output reading. Default is no timeout.
Related