People also ask
How to restart SSH session from remote host?
In case anyone is looking for a way to do this from within the remote host (similar solution): (sleep 1 sudo reboot ) exit. The parentheses spawn a subprocess, which waits one second and then initiates the reboot. The host process however immediately terminates the ssh session.
What does reboot command do in SSH?
The remote shell launches the reboot command in the background. Because the server-side shell command has exited and there is no process holding the file descriptor for standard output open, the SSH server closes the connection. The reboot command causes the machine to reboot.
How do I increase SSH timeout in Linux?
Increase SSH Connection Timeout. On the server, head over to the /etc/ssh/sshd_config configuration file. The ClientAliveInterval parameter specifies the time in seconds that the server will wait before sending a null packet to the client system to keep the connection alive.
Why does my SSH server keep restarting when I exit?
Because the server-side shell command has exited and there is no process holding the file descriptor for standard output open, the SSH server closes the connection. The rebootcommand causes the machine to reboot. However, this is not reliable: depending on timing, step 3 might happen before step 2. Adding a timer makes this unlikely: