3

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

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

Is there any way around this?

2
  • 1
    Is there a particular reason you can't change the password to do this and then change it back? – Steve Chambers Dec 27 '20 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 Dec 28 '20 at 16:43
5

sudo on macOS requires the account to have a password:

https://support.apple.com/en-us/HT202035

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.

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

You must log in to answer this question.

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