I try to disable password login for a user using ssh. Here's my /etc/ssh/sshd_config file

# Change to no to disable tunnelled clear text passwords
PasswordAuthentication no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

UsePAM no

I believe these three directives are needed to make the change, however, after I reload, it doesn't make a difference.

I am pretty sure I edited the sshd_config file, not ssh_config file.

Any idea why?

  • Possibly one of those cases where you're changing options that require an actual restart and a reload is insufficient? – HBruijn Sep 15 '14 at 13:35
  • I did try stop and start sshd, but no luck. – Michael Sep 16 '14 at 3:46

As long as you restarted sshd after making the configuration change to /etc/sshd_config, you should be fine. Although it will NOT authenticate passwords after this configuration is set, it will continue to prompt for passwords to the best of my knowledge.

I would restart ssh, then test using a known working password. You should be able to observe that entering the correct password results in a warning telling you incorrect password.

I personally haven't seen any ssh prompt without a password, even when set only to use keys.

Hope this helps, best of luck


Have you added support for keys? Shared keys have been around for awhile. This webpage is from ye olde days of 2001 and it's still relevant today. Add the following settings:

RSAAuthentication yes
PubkeyAuthentication yes

Without those two, you won't get support for logging in with shared keys. If the first page isn't nice enough for you, here's one from 2008 that should work all the same.

After changing /etc/ssh/sshd_config (or whatever directory/file combination it is in your installation), you will need to restart the sshd server. Shared keys also require that you install them for the account you are logging in with; no key = no login with shared keys. Using a 2nd ssh session, attempt to log in with your shared key. Don't close your first shell (the one you used to make the edit to sshd_config) until you have it working 100% right.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.