Posted under » Linux on 18 November 2024
openSSH is not enabled or installed by default on most OS. You have to install it on your own eg. this and this.
So you have to start the ssh daemon (sshd) automatically by using the systemctl enable command.
$ systemctl enable sshd
This doesn't start automatically so you can use the following commands too.
$ systemctl start sshd $ systemctl status sshd
sshd which runs server-side, closes the connection from the server-side if the client goes silent. To prevent connection loss, instruct the ssh client to send a sign-of-life signal to the server once in a while.
The configuration for this is in the file $HOME/.ssh/config, create the file if it does not exist (the config file must not be world-readable, so run chmod 600 ~/.ssh/config after creating the file). To send the signal every e.g. four minutes (240 seconds) to the remote host, put the following in that configuration file:
Host lmao #if a particular host
HostName aws.com
ServerAliveInterval 240
Host * #all hosts
ServerAliveInterval 240