Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I added this to the bottom of the sshd_config file

Match User user
    PasswordAuthentication no

Then I restarted SSH, and when I went to go SSH into my server I got the error

Permission denied (publickey)

How do I make it so a specific user can login to the server without entering a password or needing a key?

share|improve this question
Wait. You want to allow remote logins without a password OR a key?!? What on earth could be a valid reason for doing this? – MDMarra Aug 5 '12 at 3:39
I was just trying to find out if it was even possible. – Max00355 Aug 5 '12 at 4:04
You can leave your car doors unlocked and the keys in the ignition too. It might not get stolen. – Michael Hampton Aug 5 '12 at 4:39

SSH assumes that you are using some type of authentication, be it password, key auth, kerberos, etc. By setting PasswordAuthentication no, you're just telling your sshd that it should not allow that as a possible authentication method. It still needs some sort of authentication, though.

I suppose there would be a way to do this using PAM if you really, really, really wanted to disable all authentication, but this is a very, very, very ill-advised course of action.

Don't do it.

When set up correctly, key auth is just as transparent as using no password, and is much more secure.

share|improve this answer

You might want to have a look at rsh with a rhosts file. It's insecure, but so is ssh without authentication. I would recommend you set up passwordless ssh keys if you need to do something like this.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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