24

This happened many times.

While the SSH active, I'm so tired and just close the terminal without exit

Is it dangerous to doing like that?

  • Simply hit Ctrl+D twice instead of Alt-F4 or Ctrl-Q, this sends the exit signal to your current ssh, then to your shell, and the terminal emulator should close automatically without shell. Problem solved. – Profpatsch Mar 15 '13 at 11:00
  • @Profpatsch: unless, of course, you use IGNOREEOF (in bash) because you also use a terminal multiplexer and got tired of sometimes mistyping ^a d as ^d, thereby quitting unintentionally. – 0xC0000022L Mar 15 '13 at 13:02
28

Not at all. When the terminal process exits, the client processes within will also die, and when this happens, the connection to the remote server will be closed by the operating system. The server will see the connection close, and terminate the processes on the server.

However, it is possible that you might end up with lingering processes on the server if they were backgrounded and ignore certain signals.

10

When we closes the terminal directly, It generates a SIGHUP signal. This signal kills all the tasks/processes under the terminal automatically/instantly. So no problem occurring.

-1

This may not be true. If bash is running a loop, it can ignore SIGHUP and continue the session. I'm currently trying to work out why this happens.

Also, the shutdown process is noted very well here but apparently Systemd has changed some behaviours.

https://serverfault.com/questions/463366/does-getting-disconnected-from-an-ssh-session-kill-your-programs

  • It would be better if you validated your claim first before answering, rather than answering with "this may not be true". – Kusalananda Jan 12 '18 at 11:32
  • Well it all depends. It seems to be different between: * Init system settings * Shell settings * Processes being run in the terminal and their signal handling – NeuralSandwich Jan 12 '18 at 11:47

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.