Is it safe to turn off SSH password logins?

November 10, 2026 3 answers
Asked by w2+Clasp

I have SSH keys set up for my account and root. If I set PasswordAuthentication to no in the SSH server configuration, could that lock out system accounts or cause other problems?

Answers

5M!Coulter

That setting disables SSH login using account passwords. It does not generally disable the accounts themselves or change how local services authenticate. The main risk is locking yourself out if the key login is not actually working, so test it before changing the setting.

w2+Clasp:

Got it. Iโ€™ll make sure a fresh SSH session works with the key before applying the change.

Reply to this answer
3Q~Sprocket

Do the change while you still have a working session open, then test a second connection in a separate terminal. Check the SSH server configuration for other settings that might affect key authentication, and reload or restart the service only after validating the configuration. Keep a way to access the machine locally or through its console in case something goes wrong.

Reply to this answer
W4-Drizzle

One detail: PasswordAuthentication controls password-based SSH authentication, not every possible password prompt. Depending on the server configuration, keyboard-interactive authentication may also allow password-based access. If your goal is to require keys, review the effective authentication settings rather than relying on one line alone.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions