Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to decrease ssh connection timeout value [closed]

I have a list of full remote host ip addresses. I wrote a script to connect all the hosts in this list, one by one. My question is, sometimes when an IP address is down, script waits for a while (maybe a couple of minute) to go and execute next host. So I would like to decrease this waiting time. For example after 10 s, I want ssh connection is timeout and my script tries the next IP address. So how I can tweak this?

Thanks

like image 324
JavaRed Avatar asked Aug 22 '13 19:08

JavaRed


People also ask

How do I adjust SSH timeout?

Use the ssh_timeout command to set the number of minutes that the SSH session can be idle before it is closed. The default timeout interval is 0 minutes. Use this value, if you do not want the SSH session to expire. The minimum timeout interval is 2 minutes.

How do I fix connection timeout in Linux?

Login to the client machine and open the /etc/ssh/ssh_config file to set the necessary parameter values to increase the SS connection timeout. ServerAliveInterval and ServerAliveCountMax parameters are set to increase the connection timeout. These parameters work similarly to the server-side configuration parameters.

Why does my SSH keep timing out?

The most common ones are: Connecting to a wrong/outdated IP/host. Connecting to the wrong SSH port. Firewall blocking the connection.


1 Answers

if you call ssh script you can use something like that

ssh -o ConnectTimeout=10  <hostName>

where 10 is the number of seconds

like image 179
rderoldan1 Avatar answered Sep 22 '22 19:09

rderoldan1