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
已提问 2 年前771 查看次数
2 回答
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
支持工程师
已回答 2 年前
  • 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
已回答 2 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则