Longer SSH and FTP session
6 Replies
@marko_roi:
I am using Putty and Filezilla, what I don't like is that often when I am inactive for 5-10 minutes they close connection and I have to reconnect. I would guess I need to set longer time for this somewhere on server? I found that I need to change SSH_config and add ServerAliveInterval 180 or more but I still get dissconnected?
Sounds like your home router is disconnecting idle sessions. This is a common problem.
You can configure your ssh server to send traffic on an idle session; that normally makes the router think the session is still active and so doesn't disconnect it. ClientAliveInterval would be the setting in /etc/ssh/sshd_config.
Sets a timeout interval in seconds after which if no data has
been received from the client, sshd will send a message through
the encrypted channel to request a response from the client. The
default is 0, indicating that these messages will not be sent to
the client. This option applies to protocol version 2 only.
eg "ClientAliveInterval 60" will send a message every 60 seconds (if the channel is idle) to keep it open.
Of course, restart sshd after making this change!
Edit, I tried
ServerAliveInterval 150
ServerAliveCountMax 10
But seems that this doesnt even exsist. So ClientAliveInterval should be set.
ClientAliveInterval 15
ClientAliveCountMax 4
In your sshd_config file should do, that will send data to the client every 15 seconds and disconnect after 4 failures.
The ServerAlive versions you can put client side but don't apply to putty. (There probably is an option for something similar somewhere).