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
gefragt vor 2 Jahren771 Aufrufe
2 Antworten
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-TECHNIKER
beantwortet vor 2 Jahren
  • 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
beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen