SSH (ssh.service)
Install:
sudo apt update
sudo apt install openssh-server
sudo systemctl enable ssh
sudo systemctl start ssh
sudo status ssh
| Setting | Value | Why |
|---|---|---|
Port | <SSH_PORT> | Moves SSH off port 22, which cuts down automated scans |
PermitRootLogin | no | Root can’t log in directly |
PubkeyAuthentication | yes | Key-based login |
PasswordAuthentication | no | Keys only, no passwords |
MaxAuthTries | 6 | Default |
Config: /etc/ssh/sshd_config or a drop-in in /etc/ssh/sshd_config.d/*.conf
Connect
ssh -p <SSH_PORT> <USER>@<LAN_IP> # on the LAN
ssh -p <SSH_PORT> <USER>@<HOSTNAME> # anywhere, via Tailscale MagicDNSCheck effective settings
sudo sshd -T | grep -Ei '^(port|permitrootlogin|passwordauthentication|pubkeyauthentication|maxauthtries)'Apply changes safely
Keep your current session open while testing a new one:
sudo sshd -t && sudo systemctl restart sshRelated: 04 - Firewall (UFW) · 05 - Fail2ban · Back: 00 - Overview