Lightsail SSH window keep closing . I need to keep it open for 10mins

0

i googled to find any way to do that.

TCPKeepAlive no ClientAliveInterval 30 ClientAliveCountMax 240 ServerAliveInterval 180 ServerAliveCountMax 2

Tried all above in /etc/ssh/ssh_config file ran "sudo service sshd restart" after changing values and saved the file.

It used to work at the beginning and now it basically ignores those settings. Any ideas what make it ignore those settings?

alexk
asked 2 years ago771 views
2 Answers
0

Hey Alex,

I would suggest to make the changes as below on the client and server side.

  1. Client-side settings —————————————————————— To avoid session timeout for a user, we edit the ~/.ssh/config file. So, in this configuration file, we add the following code. Host * ServerAliveInterval 300 ServerAliveCountMax 2

Timeout value = ClientAliveInterval * ClientAliveCountMax =600seconds = 10 Minutes

This indicates that a null packet is sent to the server every 300 seconds twice to keep the session alive.   2. Sever-side settings ———————————————————————— Similarly, server-side settings also affect all client connections. Hence, to make such a change, we edit the configuration file. In the /etc/ssh/sshd_config file we add the following. KeepAlive yes ClientAliveInterval 300 ClientAliveCountMax 2 These settings make the server send a null packet every 300 seconds. It shows a timeout after trying for two times.

    1. Restart the ssh service after setting the values. # service sshd restart

Suggestions

  1. Monitor the connection. If it still drops, gradually decrease the ServerAliveInterval setting in the config file until the connection is stable.
  2. I would also suggest to have a look at this article which explains to keep running SSH session using screen or tux command. https://www.ubuntupit.com/how-to-keep-remote-ssh-sessions-running-after-disconnection/
AWS
SUPPORT ENGINEER
answered 2 years ago
  • Sorry i am using only ssh from amazon lightsail webpage. its server side? what is client side. Anyway it do not work at all now. it used to work in the beginning. But somewhere something changed

0

I am using MOBAXTERM now. Solved all ssh issue. Its permanently ON. Also i can edit better with that Amazon ssh console. Amazon should create better SSH terminal that needs to "wow" people with its developer centric stuff. SSH terminal should be able to open multiple instance in two side views and copy paste should be a click like in mobaxterm. Best is though each instance should be its own drive so client side editor like visual code can work on it directly. It improves productivity

alexk
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions