1

I am running Ubunut 14.04 and when the monitor goes to sleep the ssh connection is lost. I can't figured out why these two correlated. I had through perhaps the system was going into hibernate mode or some sort of sleep mode, but I don't think the system is going into a sleep or hibernate mode (if it does I can't figured out how to determine this).

In the "Brightness & Lock" screen the "Turn screen off when inactive for: " is configured for 5 minutes. Lock is disabled. "Require my password when waking from suspend" is checked and when the monitor awakes the password screen is present. So, I think the system is going into suspend mode, but in the "Power" screen the "Suspend when inactive for" is set to "Don't suspend".

So, I am at a lost as to why I am losing my ssh connection when the monitor is going to sleep. Thanks.

Edit: I failed to mention, I am actively using the ssh connection from another machine when I notice the monitor go dark and shortly thereafter I lose the ssh connection.

Edit: Also found out that my Samba share folder disappears within Windows. So, now more confused than before.

1

Loosing SSH connection mostly depend on server and your process on server . As explain if monitor goes down and your Linux lock your screen it means that you didn't work with SSH connection for a while . In Linux there is argument by the name of TMOUT , as an example if you set TMOUT=60 if you don't touch your console for 1 minute you will be logout . For solving this problem set TMOUT to reasonable variable .

In ssh daemon config on server , there is TCPKeepAlive variable which try to keeping connection up .

$ vim /etc/ssh/sshd_config

And uncomment TCPKeepAlive yes to tell the service to try keeping alive connection .

  • I did check the /etc/ssh/sshd_conffile and the TCPKeepAlive setting was set to yes. I didn't state it explicitly, so I will update the description, but I am actively interacting with the ssh connection from another machine and when I see the screen go dark the ssh connection will go down shortly thereafter. – lordhog Aug 15 '17 at 19:21
  • what about TMOUT ? try echo $TMOUT on your machine . – Ali Ghasempour Aug 15 '17 at 19:24
  • Sorry about that, I did check TMOUT and it does't seem to be defined. I will set it to something like 60 minutes and see if that helps. Thanks. – lordhog Aug 15 '17 at 19:28
  • Your welcome . If it works , try export TMOUT to set permanently . – Ali Ghasempour Aug 15 '17 at 19:32
  • ssh parameters -o TCPKeepAlive="yes" and -o ServerAliveInterval="60" seems to help. – Pablo A Oct 2 '17 at 1:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.