====== SSH config ====== vi /etc/ssh/sshd_config ====== Key only access ====== ===== Root ===== PermitRootLogin prohibit-password ===== User ===== PasswordAuthentication no RSAAuthentication yes PubkeyAuthentication yes ===== Specific to user ===== Match User alice,bob,john PasswordAuthentication no ====== Deny User access ====== DenyUsers johnd admin nagios ====== Deny Groups access ====== DenyGroups wheel adm video apache ====== Deny User access ====== Deny Users johnd admin nagios ====== Disable IPv6 ====== Address Family inet ====== Set Modifications ====== systemctl restart sshd ====== References ====== * https://tecadmin.net/deny-allow-access-for-users-and-groups-in-openssh/ * https://www.xmodulo.com/how-to-force-ssh-login-via-public-key-authentication.html * https://blog.stephane-robert.info/docs/securiser/durcissement/ssh/