Prior to OS X Catalina I could add a user to the sudoers by editing /etc/sudoers with an admin account.

With OS X Catalina, I can no longer do this as it seems that Catalina moved to a read-only root filesystem and so /etc/sudoers cannot be edited.

According to this official Apple User Guide, it appears that the sudoers file is now located at /private/etc/sudoers, but I am still unable to edit this file with an admin account.

What is the correct way to grant a user sudouers access in Catalina?

  • 2
    What do you mean by "can‘t be edited"? Doesn‘t sudo visudo work on Catalina any longer? What error do you get if you run this? – nohillside Apr 21 '20 at 5:03
  • Why was this down voted? It's a valid question any normal Mac user could possibly have. +1 – Allan Oct 12 '20 at 15:31
  • @Allan The user claims that the behaviour changed with Catalina (which it didn't), and doesn't show the actual command used. So it's hard to see what exactly went wrong. The answer is good though, and of general use. – nohillside Oct 12 '20 at 17:02
  • It not clear and he’s mistaken, yes @nohillside, but down vote worthy? That I disagree with. We see way more question with less detail get flagged/closed, but not down voted. I just think there are some here too eager to down vote and I believe it’s off putting to new(er) users. – Allan Oct 12 '20 at 18:20
  • @Allan I share the feelings regarding the apparent focus on downvote (and now, I didn't downvote, but maybe the two users who upvoted my initial comment did). – nohillside Oct 12 '20 at 18:46

It turns out that even an admin user needs to use sudo to edit the sudoers file at /private/etc/sudoers so the following did the trick to open the file for edit:

$ sudo visudo /private/etc/sudoers

As usual, a user can be added to the list of sudoers by adding a line such as this:

username ALL=(ALL) ALL
  • Given this answers the question you can accept your own answer to mark it as solved. – Alex Apr 21 '20 at 4:35
  • 1
    ...was this not the case prior to Catalina? That’s odd! O_O – Wowfunhappy Oct 12 '20 at 0:37

If you want to be able to use sudo without typing a password:

sudo visudo

And add:

username        ALL = (ALL) NOPASSWD:ALL

Adding this gives any commands, including scripts, you execute in the terminal ability to run sudo without a prompt, which exposes you to increased risk of exploitation. Use with caution.

  • I advise extreme caution when doing this. This is horribly insecure because you are literally giving admin rights with no authentication. – Allan Oct 12 '20 at 3:43
  • Right. Use with care, especially when executing scripts. But I think giving people options is useful, rather than not useful, so the downvote was unjustified (whoever it was). – Adam Millerchip Oct 12 '20 at 14:30
  • Between you, me and the lamp post, the excessive down votes by an unknown few in the community is irksome. I don't down vote unless egregious - like outright wrong and/or dangerous. This answer could benefit from text highlighting the potential risks, but IMO, it's not down vote worthy. However, +1 to offset. – Allan Oct 12 '20 at 15:28
  • Alright, I've added a warning. – Adam Millerchip Oct 12 '20 at 15:39

You must log in to answer this question.

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