1833758 Members
2888 Online
110063 Solutions
New Discussion

Detect SFTP hang

 
Raynald Boucher
Super Advisor

Detect SFTP hang

Hello all,

Someone in our organization made a change that incapacitated sftp. We could ping the target server but connection attempts through scp, ssh and sftp would just hang indefinitely.

Is there a way we can configure ssh clients to exit with a non zero return code after a specific period of inactivity?

Thanks

RayB
6 REPLIES 6
Tingli
Esteemed Contributor

Re: Detect SFTP hang

run ssh -v to find what does it say.
James R. Ferguson
Acclaimed Contributor

Re: Detect SFTP hang

Hi Ray:

> Someone in our organization made a change that incapacitated sftp

Was that deliberate? Is this the way you intend to leave the configuration? What exactly was done and to what goal?

Regards!

...JRF...
James R. Ferguson
Acclaimed Contributor

Re: Detect SFTP hang

Hi (again) Ray:

Do you have 'TCPKeepAlive' enabled in your 'sshd_config' file?

Regards!

...JRF...
Raynald Boucher
Super Advisor

Re: Detect SFTP hang

It wasn't a sabotage attempt.
Someone at corporate network group made a planned routing change with an unconfirmed firewall change during business hours.

The issue has been resolved but I'm just trying to secure our batch application(s) in case this happens again.
If this had gone undetected, our batch stream would have been delayed extensively by the hang until the backup failed to start. Someone would have gotten paged in the middle of the night etc etc etc.

As for the debug listing:
$ sftp -vvv @
Connecting to wellness...
OpenSSH_4.0p1, OpenSSL 0.9.7m 23 Feb 2007
debug1: Reading configuration data /usr/local/etc/ssh_config
debug2: ssh_connect: needpriv 0
debug1: Connecting to [xxx.xxx.xxx.20] port 22.
debug1: Connection established.
debug3: Not a RSA1 key file /batch/.ssh/id_rsa.
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: missing keytype
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug2: key_type_from_name: unknown key type '-----END'
debug3: key_read: missing keytype
debug1: identity file /batch/.ssh/id_rsa type 1
debug3: Not a RSA1 key file /batch/.ssh/id_dsa.
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: missing keytype
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug2: key_type_from_name: unknown key type '-----END'
debug3: key_read: missing keytype
debug1: identity file /batch/.ssh/id_dsa type 2
Raynald Boucher
Super Advisor

Re: Detect SFTP hang

Here are the references to "Alive" in our config file.

$ grep Alive ssh*config
ssh_config:#ServerAliveInterval 15
ssh_config:#ServerAliveCountMax 3
sshd_config:#TCPKeepAlive yes
sshd_config:#ClientAliveInterval 0
sshd_config:#ClientAliveInterval 15
sshd_config:ClientAliveInterval 45
sshd_config:ClientAliveCountMax 3
$

RayB
Tingli
Esteemed Contributor

Re: Detect SFTP hang

rename file /batch/.ssh/id_rsa to something else and try it again.