I'm using python with paramiko (wrapped in pysftp) and there appears to be an issue where it will hang for a long time if it cannot authenticate during ssh. I can't figure out a way to set a timeout for the connection and I'm cycling through many machines, so a single machine that is pingable, but not ssh'able (can't reach via cmdline ssh either) is hanging everything. Using this:
ssh -o ServerAliveInterval=1 -o ServerAliveCountMax=1 <host>
I can at least get it to error out after 1 second without waiting for a long time for the authentication in paramiko to die out and raise an exception. However, I can't figure out how to pass these ssh_config options to paramiko (or better yet to apply a timeout to the connect). I tried using the SSHConfig module and that reads in a config file, but it doesn't seem to apply the data anywhere, seems more used for host aliases.
Any help would be appreciated, been searching around for information/help for many hours.
Establish the initial connection using
SSHClient.connect()
with a specified socket timeout, then create aSFTPClient
using its transport.Successful connection
Timed out connection