This is an old revision of the document!
To login to any machine with SSH, you need to install the ssh server. The client is installed on Debian by default. Terminology used is “Server” for the remote machine to get access to, and “Host” for the local machine which needs access to a server. This guide was updated 8th August 2020.
apt install ssh
Port 22 LoginGraceTime 20 AuthorizedKeysFile .ssh/authorized_keys PasswordAuthentication no PermitEmptyPasswords no PermitRootLogin without-password
Match Address my.host.subnet.ip PermitRootLogin without-password
X11Forwarding yes X11DisplayOffset 10 PrintMotd no PrintLastLog yes TCPKeepAlive yes
sudo /etc/init.d/ssh restart
ssh-keygen -t ecdsa -b 521
I have machines in a location without fixed IP address, and where external access is only possible through a relais host which disconnects after 2+ minutes of inacitivity. I solve this by adding the following to the sshd_config of each machine which need to be accessed.
ClientAliveInterval 300 ClientAliveCountMax 2
Alternatively, it could also be handled on the client side with the following lines in ssh_config, or keep alive setting in PuTTY.
Host * ServerAliveInterval 300 ServerAliveCountMax 2
In addition I have restricted SSH access to machines with known IP addresses
$ who
authorized_keys
filerestrict,from="aaa.bbb.ccc.ddd,eee.fff/16" ==== Links ==== * [[https://patrickmn.com/aside/how-to-keep-alive-ssh-sessions/#:~:text=On%20Linux%20(ssh)&text=These%20settings%20will%20make%20the,to%20have%20been%20discarded%20anyway.|How to Keep Alive SSH Sessions]] * [[https://superuser.com/questions/1272875/relay-two-ssh-connections-together|Relay two SSH connections together]] * [[https://www.thethingsnetwork.org/docs/gateways/kerlink/reverse-ssh/|Reverse SSH]] * [[http://man.openbsd.org/sshd_config#:~:text=The%20client%20alive%20mechanism%20is,disconnected%20after%20approximately%2045%20seconds.|sshd_config — OpenSSH daemon configuration file]] ===== X Client ===== ==== Debian ==== * Establish an ssh connection from your graphical desktop to the remote X client using the “-X” switch for X11 forwarding:<code>ssh -X <user>@<Xclient> sensible-browser
sensible-browser