đŸ’¾ Archived View for chirale.org › 2019-03-10_4933.gmi captured on 2024-05-12 at 15:08:08. Gemini links have been rewritten to link to archived content

View Raw

More Information

-=-=-=-=-=-=-

Disable password authentication on sshd

To disallow password authentication on ssh, adduser –disabled-password will not disable openSSH password.

adduser –disabled-password

To disable the password authentication, you have to put these values on /etc/ssh/sshd_config to:

PasswordAuthentication no UsePAM no PermitRootLogin no

Then you’ve to:

systemctl restart sshd

to apply changes.

Connection will not be reset so before logout try to login on a different terminal to check you can login.

Actually PermitRootLogin disable the root login for any method, but it’s an useful addition. Remember to add at least one user to the sudo group or you will not be able to operate as super-user without using su – root.

To check if password auth is disabled:

ssh -o PreferredAuthentications=password USER@HOST

Exprected output is:

USER@HOST: Permission denied (publickey).

https://web.archive.org/web/20190310000000*/https://explainshell.com/explain?cmd=adduser+--disabled-password