In Mac OS X 10.6, how do I give myself permanent sudo privleges? is it like linux, in the "/etc/sudoers" file?

  • 3
    You know that sudo is there for a reason, right? The idea is to give access to superuser privileges without being constantly logged in as root (not a good idea). – blahdiblah Jun 6 '11 at 21:26

Not exactly experienced in OSX, but it seems to be located in either one of the following:

  • /etc/sudoers
  • /private/etc/sudoers

It is recommended that you use visudo to edit the file but you can use another text editor.

Under the line that says root ALL=(ALL) ALL

You add the name of the user and user ALL=(ALL) ALLto give yourself permanent sudo privileges.

| improve this answer | |
  • 2
    ls -ld /etc results in lrwxr-xr-x@ 1 root wheel 11 30 Jun 2010 /etc -> private/etc, so they're both the same file. – Daniel Beck Jun 6 '11 at 21:22
  • yea, I did it in fedora a while ago.. It seems to be the same process, but thanks.. didn't wanna just go haphazardly changing important system file :D – FALL3N Jun 15 '11 at 0:40
  • 1
    On OSX at least, you execute just sudo visudo to edit the sudoers file (don't specify the file.) – Parag Apr 1 '17 at 14:44

You can, of course, edit /etc/sudoers manually to accomplish this.

But Mac OS X's System Preferences has a method built-in to achieve the same thing: Give the user an Administrator account, instead of a Standard account, and it will be added to /etc/sudoers as sudoer automatically (via the wheel group membership).

Users will still need to enter their own password though, which is a good thing (tm).

| improve this answer | |
  • Yeah, I've done that in fedora, but I wanted to ask before I did it, so I didn't break anything.. thanks – FALL3N Jun 15 '11 at 0:38
  • Wait, aren't there other special privelages that come with giving a user an "Administrator" account other than just that it adds them to the sudoers file? – cmcculloh Jul 16 '12 at 15:53
  • 2
    @cmcculloh It's not adding the account to the sudoers file, but membership in the wheel and admin groups, complete with e.g. write permissions to /Applications and comparable other global folders. Just compare the output of e.g. id in Terminal of normal and admin users. – Daniel Beck Jul 16 '12 at 18:41
  • I discovered you need to enable root access in MacOSX 10.8. support.apple.com/en-us/HT204012 – Keith John Hutchison Jun 22 '15 at 16:54

sudo in OSX is exactly like that under Linux, and like Linux man sudo shows the details

sudo determines who is an authorized user by consulting the file /private/etc//sudoers.

/etc is a symbolic link to /private/etc so your suggestion of /etc/sudoers will work.

| improve this answer | |

You could as well run sudo -s

This will give you root permissions for that session.

To return to normal permissions, just type exit

| improve this answer | |
  • This answer is pretty awesome. There's definite use cases for having sudo access for just a session. – ericmjl Sep 25 '17 at 14:48

Unlock the root account.

Steps to unlock "root" in Mac:

•1.Open Directory Utility (/Applications/Utilities/Directory Utility.app)

•2.Go to Edit > Enable Root User

•It will prompt for password,press ok for BLANK password.

Logout,then type root in Username and your IN!!!!!!!! (Note:Make Sure that NAME & PASSWORD IS CHECKED IN LOGIN OPTIONS.)

| improve this answer | |
  • This isn't an answer to the question that was asked. Sudo is not the same as unlocking the root account. – HopelessN00b Aug 14 '14 at 1:00
  • In MacOSx 10.8 sudo is not available until root access is enabled. So the answer is valid. – Keith John Hutchison Jun 22 '15 at 16:55
  • No such place on OSX 10.11 – WilliamK Mar 25 at 23:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.