Question

Keep my SSH session alive

When i leave my session on X2GO or XRDP my firefox is killed but how my firefox can run ?

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi,

Shouldn’t it instead be

ClientAliveInterval 30
TCPKeepAlive yes
ClientAliveCountMax 99999

Hello all,

I’m giving an updated answer on the question so that it’s easier to follow:

To paraphrase, in order to keep your connection alive for more than the default time, some adjustments will be needed.

First, you’ll need to edit your sshd_config file.

vi /etc/ssh/sshd_config

Find the following lins and uncomment them

TCPKeepAlive
ClientAliveInterval
ClientAliveCountMax

Once you do, change their values to

TCPKeepAlive yes
ClientAliveInterval 30
ClientAliveCountMax 99999

Save the changes you’ve made and restart your sshd service

service sshd restart

You need to edit your local SSH config as well. You’ve finished the first part with the questions you’ve provided.

What you need to do is add

  1. ServerAliveInterval 30

locally.

There a couple of ways to do so. You can add it in the /etc/ssh/ssh_config file like so

  1. ServerAliveInterval 10

or in your .ssh/config file:

  1. Host *
  2. ServerAliveInterval 10

To ensure the SSH session does not time out, you would want to edit the /etc/ssh/sshd_config file to ensure these settings are in place:

KeepAlive yes 
ClientAliveCountMax 99999```

After making those changes, please be sure to restart your SSH service using the command:

```service sshd restart```

If you only want to do it on a per session basis, you could just append this flag to your SSH command:

```-o ServerAliveInterval=100```

Hope it helps!
Jason Colyer
DigitalOcean Platform Support Lead