How to reduce ssh connection timeout value

I have a list of the full IP addresses of the remote host. I wrote a script to connect all the hosts in this list one by one. My question is that sometimes, when the IP address is not working, the script waits for a while (maybe a couple of minutes) to go ahead and execute the next node. Therefore, I would like to reduce this waiting time. For example, after 10 seconds, I want the ssh connection to timeout, and my script tried the following IP address. So how can I customize this?

thanks

+6
source share
2 answers

if you call ssh script you can use something like this

ssh -o ConnectTimeout=10 <hostName> 

where 10 is the number of seconds

+13
source

You can learn much more by typing man ssh for OpenSSH command line options and man sshd for OpenSSH daemon options ...

+1
source

Source: https://habr.com/ru/post/952308/


All Articles