sftp connection closes if idle for around 10minutes

does sftp connection closes by default if it stays idle for a prolonged time ?

i have checked sshd_config files , there is no time out value set. but still the connection closes after certain period of time.

Please help.

verbose mode output :

sftp> debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
Connection to [x.x.x.x] closed by remote host.
debug1: Transferred: stdin 0, stdout 0, stderr 53 bytes in 600.6 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.1
debug1: Exit status -1

Take a look at the ServerAliveInterval option to sftp\ssh.

Hope this helps.

oops. no such option in sshd_config file

Have a look here - OpenSSH FAQ
Search for ServerAliveInterval.

ok i need to try that out and see , i have one more query.

In the below output exit status is -1 and stderr 0.1 is this normal or any issues ?

because the sftp happens through a cron job and sometimes the sftp seems to fail.

sftp> debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
Connection to [x.x.x.x] closed by remote host.
debug1: Transferred: stdin 0, stdout 0, stderr 53 bytes in 600.6 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.1
debug1: Exit status -1

The destination server is out of network , and doesnt not allow ping , even ssh. only sftp works with a specific port number.

so we experience this connection drop at times and we need to find out why this happens.

That look likes an error, but I'm not sure what that is.

If there is a Firewall in the middle that doesn't allow SSH session, SFTP will not work. SSH File Transfer Protocol - Wikipedia, the free encyclopedia

SFTP uses Port 22.

-----------------------------edit

Sorry didn't see that you are using a specific port.
Anyway check with the Firewall guys, maybe they can see anything more then we could.

well we checked and they could not find any error. Problem is the sftp connection does not close always. it happens sometime in a day , doesnt have any pattern , but happens . We got a suggestion of using tcpdump to monitor the connectivity but ours is a solaris box. so i believe we have to go with snoop.
can someone help with how to use snoop in this issue

You can install tcpdump in solaris - tcpdump - Solaris package

sorry , we have to go with system utility snoop

so any help with using snoop on this issue , would be much appreciated.

You can try a simple capture between the two servers in question:

Start the capture:
snoop -o sftp.cap -d <network interface> server1 server2

CTRL-C to stop.

Read the results:
snoop -i sftp.cap -t r | more

Yes..If there is a firewall between client and server, sometimes it can disconnect due to FW settings. Firewall may be configured to drop Idle connections.

Charith