Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ssh timeout

Status
Not open for further replies.

dandan123

Technical User
Sep 9, 2005
505
US
I'm running a script which collects information from servers -

ssh <hostname> command

This is taking a long time to complete ( 4000 + servers ) as if a server is offline then ssh takes a long time to timeout.

Is there anyway to change this timeout period without modifying the config files for ssh ?

TIA
 
Look in the man page for the -o ConnectTimeout option

[Blue]Blue[/Blue] [Dragon]

If I wasn't Blue, I would just be a Dragon...
 
Add it into your ~/.ssh/config. It must be read/write only to you. Read "man ssh_config".
like this:
ConnectTimeout 2
 
That will work on Linux but not Solaris 10


A great teacher, does not provide answers, but methods to teach others "How and where to find the answers"

bsh

35 years Bell, AT&T, Lucent, Avaya
Tier 3 for 25 years and counting
 
I run my scripts as root, If I modify anything it will affect all the other sysadmins which is why changing configs or adding anything to the home directory is ruled out.

I guess I'll have to turn to scripting to see if I can fork off a process which will kill the ssh session if it takes too long.
 

I would always just run a ping test before the ssh, just to verify the host's "upness".
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top