ssh/scp - can you specify timeout?

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ssh/scp - can you specify timeout?
# 1  
Old 01-02-2008
ssh/scp - can you specify timeout?

I am scp'ing a file from a server (servera) to my server (serverb)

If servera is down - the scp never times out ... it just hangs eternally..
It is possible to specify a timeout in my script - so if scp fails/hang for more than 60 seconds I assume its failed ?

I am aware there is some timeout value I can set on servera in the sshd_config file on servera but I would prefer if I could include some sort of timeout in my script running on serverb

Example command: scp user1@servera:testdir/test.log /logs
# 2  
Old 01-02-2008
Originally Posted by frustrated1
If servera is down - the scp never times out ... it just hangs eternally..
Really? Forever?

Is the machine on the same subnet?

Is there a firewall suppressing ICMP messages?
# 3  
Old 01-02-2008
Its on a different subnet....

Not sure if its suppressing messages or not
# 4  
Old 01-02-2008
If your using OpenSSH then use the ConnectTimeout option

scp -o ConnectTimeout=30 user1@servera:testdir/test.log /logs

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

AIX ssh timeout

I have to make a command to work when connecting to AIX 7.1 (used by an internal software). I have a linux server L where the following command is runned ssh -t <aix-server-ip> ls For a <non-aix-server-ip> the command runs successfully. For AIX the terminal just gets blocked. ssh connection... (5 Replies)
Discussion started by: ufo
5 Replies

2. Red Hat

How to solve TCP connection timeout (not in ssh)?

HI We have some Red Hat Linux Sevres which is having TCP connection timeout, not SSH connection, as an example oracle connection connected from TOD. SSH i managed to add keepalive and it's working fine (1 Reply)
Discussion started by: bentech4u
1 Replies

3. Shell Programming and Scripting

Handling ssh permission denied or timeout

Hello all, been writing a little inventory script (hpux 11.23, ksh Version 11/16/88) which takes our hostname from our inventory db and tests them with ssh connection. I need to be able to differentiate a timeout (host not reachable on main net link could try adm prod back links) and a... (2 Replies)
Discussion started by: maverick72
2 Replies

4. AIX

Set timeout value for ssh session to HMC?

Friends, Could anyone let me know - how to set the timeout value for ssh session to HMC? My HMC version is -- V7R7.4.0. I'm sure the version doesn't have anything to do with it. Thanks, -- Souvik (2 Replies)
Discussion started by: thisissouvik
2 Replies

5. Shell Programming and Scripting

Timeout to abolish ssh connection command it takes too long

Hi, I am running a ssh connection test in a script, how can I add a timeout to abolish the process if it takes too long? ssh -i ~/.ssh/ssl_key useraccount@computer1 Thank you. - j (1 Reply)
Discussion started by: hce
1 Replies

6. UNIX for Dummies Questions & Answers

SCP Connection Timeout

Hello UNIX users, Thanks for helping me in my earlier post. Now, I am facing a timeout issue when ever I am transferring a zipped file from my server to client's server. If the zipped file size is below 3 MB, it goes fine. Anything above that fails. Below is the part of screenshot from... (1 Reply)
Discussion started by: st3636
1 Replies

7. Shell Programming and Scripting

set timeout for ssh prompt

Hi all, I want to set a timeout say 10 sec to shh prompt i.e. if no password is enetered for 10 sec prompt should again come to shell. How can this be achieved ?? I am using Linux RHEL 5 and Solaris 10. Pls help. Thanks in adv. VIKAS (3 Replies)
Discussion started by: vikas027
3 Replies

8. UNIX for Advanced & Expert Users

SCP Timeout?

Hello, I was wondering is there a way for SCP to shorten the timeout to fail when it attempts to connect a host that is down. Seems like it takes about a minute or so for scp to timeout. This is on a AIX 5.3 box. I saw someone suggest use -o ConnectTimeout but the scp I use doesn't have that... (1 Reply)
Discussion started by: benefactr
1 Replies

9. BSD

SCP and ssh

I can't get ssh ans scp to work between to host on my network. I am prompted for the password and it isn't accepting the password and I know the password is correct because I am using the root password. What do I need to do to get ssh working between the two host and scp. I can putty into the... (2 Replies)
Discussion started by: rbizzell
2 Replies

10. Shell Programming and Scripting


The following ksh script is trying to get a file's cksum then, scp it over to a remote machine - get the cksum there and then compare the two cksums to make sure they match. I am having problems setting a variable on the remote host where it can be read locally. Is this even possible - reading a... (1 Reply)
Discussion started by: berrean
1 Replies
Login or Register to Ask a Question