As I see from your %params
, you use the DSA key to authenticate on the remote server. Do you really need to use the native Perl SSH implementation that Net::SSH::Perl
provides? It is useful in some cases where you cannot just wrap the regular ssh
call (e.g. if you need to provide a clear-text password for connecting to the server), but it lacks so many useful SSH options—you've just found one of them.
I suggest that you try to use Net::SSH
instead (which is a very simple wrapper to the system's ssh
binary) and give it a ConnectTimeout
and ServerAliveInterval
options with -o
, or Net::OpenSSH
which is referred by @ChankeyPathak above and use its check_master
method (as I understand from the description, it looks like what you need).
The ssh_config(1)
manual has a good description of ConnectTimeout
(which detects timeouts when establishing the connection) and TCPKeepAlive
and ServerAliveInterval
(which detect timeouts on the established connection).
For your reference: here is a complete list of options implemented in Net::SSH::Perl
, grabbed from its Config.pm
. If you do need to use any other option not listed here, use some other SSH module.
BindAddress
Host
BatchMode
ChallengeResponseAuthentication
Cipher
Ciphers
Compression
CompressionLevel
DSAAuthentication
GlobalKnownHostsFile
HostKeyAlgorithms
HostName
IdentityFile
NumberOfPasswordPrompts
PasswordAuthentication
PasswordPromptHost
PasswordPromptLogin
Port
Protocol
RhostsAuthentication
RhostsRSAAuthentication
RSAAuthentication
StrictHostKeyChecking
UsePrivilegedPort
User
UserKnownHostsFile