I created a user that I use to login with using an SSL Key. I have not set a password.

To be clear it is not an empty password, but an unset one. The /etc/shawdow has a single exclamation point where the password would normally be and I have checked that entering a password instead of using the private key does not log in.

Would setting a high length, properly randomized password that I discard be a better method?

  • 1
    It would decrease security because without a password there's no password to crack. Linux says (basically), "Hey, does [input]'s hash equal the password stored at [passLocation]?". If no password is set, the answer is always "no", because a hash will never equal nothing.
    – Jon
    Nov 9, 2014 at 6:25

1 Answer 1


Right now, there are zero passwords that will work if an attacker randomly guesses it. If you set a password, there is at least one that works if an attacker randomly guesses it. This is infinity percent more likely to happen (still very, very unlikely, but it is a nonzero chance compared to the literally zero chance it'll happen with no password), so your system is less secure with password login enabled for that user.

There are cases where passwords are useful: for instance, if you log in via an SSH key, but want to be able to run sudo, it's best to have a password protecting sudo, because that means that someone who somehow obtains your SSH private key can't log in to the server and run sudo. Likewise, you might in theory set it up so you need a key and password to log in, and not store the password anywhere but in your head, though it's more common to just encrypt the private key with a passphrase and enter that passphrase every time you want to use the key, which achieves essentially the same goal.

But what these have in common is that there are situations where you need to use the password. Adding another authentication system that you never use cannot improve security, because the only way an authentication system provides security is by requiring you to authenticate with it. If you never use it (because you threw away the password after making it), then an attacker doesn't have to either, so they can apply the same attack they'd use if the system wasn't enabled. If an attacker does use it, it's because it's an easier attack than the one they'd use if it was disabled, so it's decreased security.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .