1

I have a computer that doesn't not require a password. I'd like this to continue into sudo, but unfortunately it doesn't recognise a user not having a password.

According to Apple the sudo command requires a non-blank password: https://support.apple.com/en-gb/HT202035

Is there some way I can easily override this so I can have a blank password with sudo? It's only ever a hindrance and security on this machine is not an issue. Thanks.

1 Answer 1

4

I found an answer that works perfectly (although it requires temporarily adding a password to your user first):

  1. Open the Terminal

    Type: sudo visudo

    Enter your user's password (create one if necessary).

  2. Change this line FROM:

    %admin ALL=(ALL) ALL

    TO:

    %admin ALL=(ALL) NOPASSWD: ALL

    (press 'i' to enter insert mode if you can't edit the text)

  3. Write and Quit

    :wq

    (press 'esc' first to enter command mode)

1
  • Just a note. If you need to enter many commands which require the sudo prefix, enter sudo sh first. This will leave you logged in as the root user until you enter the exit command. As root user, the sudo prefix is implicit. May 15, 2015 at 18:51

You must log in to answer this question.

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