On Mac, how do I give myself permanent sudo privleges?
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) ALL
to 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
Related videos on Youtube
FALL3N
Updated on September 18, 2022Comments
-
FALL3N over 1 year
In Mac OS X 10.6, how do I give myself permanent sudo privleges? is it like linux, in the "/etc/sudoers" file?
-
Jerome Lecoq almost 13 yearsYou 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).
-
-
HikeMike almost 13 years
ls -ld /etc
results inlrwxr-xr-x@ 1 root wheel 11 30 Jun 2010 /etc -> private/etc
, so they're both the same file. -
FALL3N almost 13 yearsYeah, I've done that in fedora, but I wanted to ask before I did it, so I didn't break anything.. thanks
-
FALL3N almost 13 yearsyea, 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
-
Ani almost 12 yearsWait, 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?
-
HikeMike almost 12 years@cmcculloh It's not adding the account to the sudoers file, but membership in the
wheel
andadmin
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. -
Keith John Hutchison almost 9 yearsI discovered you need to enable root access in MacOSX 10.8. support.apple.com/en-us/HT204012
-
pmagunia about 7 yearsOn OSX at least, you execute just
sudo visudo
to edit the sudoers file (don't specify the file.) -
ericmjl over 6 yearsThis answer is pretty awesome. There's definite use cases for having sudo access for just a session.