Longer SSH and FTP session

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?

6 Replies

From my experience, Filezilla tends to do that no matter what I try on it, but with PuTTY you can try going to the connection tab and setting it to send keepalives every 30-60 seconds or so. It worked for me when I was on a connection that behaved like yours.

@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!

ServerAlive or ClientAlive? which to set?

I know but there is both client and server side alive interval, wondering which would help for this to work, I can put both.

Edit, I tried

ServerAliveInterval 150

ServerAliveCountMax 10

But seems that this doesnt even exsist. So ClientAliveInterval should be set.

Something like

        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).

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct