I have a user with a blank password, but now I can't run sudo with that account.

sudo ls
Sorry, try again.
Sorry, try again.
sudo: 3 incorrect password attempts

Is there any way around this?

  • 1
    Is there a particular reason you can't change the password to do this and then change it back? Commented Dec 27, 2020 at 16:56
  • Genius! Can’t ssh into a computer if the password is NULL either afaik. Same with emoji in the password, if you can’t type it, you can’t use it to authenticate.
    – bmike
    Commented Dec 28, 2020 at 16:43

1 Answer 1


sudo on macOS requires the account to have a password:


Therefore it is not possible to just press ENTER to continue at the prompt, like you would expect from some other systems.

This behaviour is enforced through a configuration of the PAM subsystem. You can change the settings for that in /etc/pam.d, where you have a sudo file that setups the authentication requirements for the sudo command.

WARNING: Changing the contents of the files in /etc/pam.d incorrectly can deny you from logging to your system at all. Only make changes if you know what you're doing, you have a backup - and you feel confident in booting in Recovery mode to undo your changes if it should fail.

  • How would I configure /etc/pam.d/sudo to allow user with empty password to use sudo?
    – Joy Jin
    Commented Dec 28, 2020 at 7:49

You must log in to answer this question.

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