On Mac, how do I give myself permanent sudo privleges?

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


Solution 1:

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.

Solution 2:

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).

Solution 3:

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.

Solution 4:

You could as well run sudo -s

This will give you root permissions for that session.

To return to normal permissions, just type exit