Sudo asking for password even though user doesn’t have a password set

passwordSecuritysudoterminal

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.

Best Answer

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)