SMOLNET PORTAL home about changes

Disable password authentication on sshd

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

adduser –disabled-password (https://explainshell.com)


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 (https://web.archive.org)
Response: 20 (Success), text/gemini
Original URLgemini://chirale.org/2019-03-10_4933.gmi
Status Code20 (Success)
Content-Typetext/gemini; charset=utf-8