Ssh – Does temporary disconnecting of ssh session affect a running program

ssh

i found that if my internet connection is disconnected during a ssh session to a remote Linux server, and then reconnect within a short time, the ssh session is still alive.

If I am running a program on the server and redirect its stdout and stderr outputs to a file, temporary internet disconnection doesn't seem to stop the program from running.

But will the disconnection affect the content of the file?
I thought it wouldn't.
I found some content of the file not repeatable when reruning the program without interruption to my internet connection, but I am not sure if the interruption to internet connection is the cause.

Best Answer

If the session stays active then it stays active. There's no trickery there, just a buffer and TCP doing it's thing.

So if an connection to an ssh session is lost then recovered due to a "poor" internet connection, the app that is running in that session never knows. The session continues.

It's a lot like unplugging your monitor (while looking at the console) should not effect the app running on that console.

Related Question