SSH
On the client machine(s), generate a new key
ssh-keygen -t rsa -b 4096Copy it to the server
ssh-copy-id username@192.168.x.xSecuring SSH
sudo vim /etc/ssh/sshd_configChange the default port
Port 2222Disable root login
PermitRootLogin noDisable password authentication
PasswordAuthentication noDisable empty password
PermitEmptyPasswords noLimit failed attempts
MaxAuthTries 3Allow specific users only
AllowUsers user@192.168.1.*Restart SSH
sudo systemctl restart sshSet up OTP
Install Google Authenticator PAM
sudo apt install libpam-google-authenticator -yExecute and follow the on-screen instructions
google-authenticatorsudo vim /etc/pam.d/sshdauth required pam_google_authenticator.sosudo vim /etc/ssh/sshd_configChallengeResponseAuthentication yes
UsePAM yes
AuthenticationMethods publickey,keyboard-interactiveValidate SSH configuration
sudo sshd -t