Ubuntu – WinSCP has to constantly reconnect to the Ubuntu Server

sshUbuntuwinscp

I am on a Window 7 machine so I am left to using a tool like WinSCP to manage my remote servers which run Ubuntu.

I do use a good old command line too but for file management I generally use WinSCP, it;s a nice tool that acts like an FTP client but I believe it's over SSH or SFTP instead.

Now something that is really annoying and slows me down if after 10-20 minutes ( I have no idea of the actual time) of sitting idle, when I go to transfer a file over WinSCP, it has to like reconnect, it;s a fast process and does not ask me for a password again or a key file…but it seems that it like times out or disconnects to a certain point…i'm not sure if it really is disconnected or not since it like reconnects right away but it does take a good 15-30 seconds which is annoying.

I would love to figure out a way for it to always be fast and snappy as if I had just connected all the time and not timeout like it does after being idle for a while.

So I am asking, is this likely a setting or problem in WinSCP or more likely I think it is a setting in my server?

Any ideas on how to extend the time it stays logged on without it reconnecting all the time?

I saw somewhere to look for a SSH config file so I found this file sshd_config in etc/ssh/sshd_config the content are below, I don't see anything that stands out to myself (not saying much)…

LogLevel INFO

# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile %h/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60
#Banner /etc/issue.net

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes

Best Answer

Most likely you have a stateful firewall/nat between your system and the remote system that is timing out the state data for your connection after 15/20 minutes. Modify the keepalive setting in your client. A value of 120 seconds is what I usually use.

Modifying the firewall/nat device causing the problem would also be possible, but may have other side effects.

Open the following dialog at Sessions/Sites/Site Manager:

winscp keepalive

Related Question