How To Set The Root Password on Mac OS X?

Joined
Apr 29, 2006
Messages
4,576
Reaction score
378
Points
83
Location
St. Somewhere
Your Mac's Specs
Mac Studio, M1 Max, 32 GB RAM, 2 TB SSD
I have just switched to Mac, from Windows and Linux. I have had my new Mac (a Power Mac G5, OS X 10.4.6) for about a week now. Today, for the first time, I tried out sudo and just su itself. Trouble in paradise...

su prompted me for a password. At no time during the set up of this Mac was I ever asked to enter a root password - I had hoped it simply hadn't been set, and typing "su" would just log me in as root. Is there a default password that all Macs come with that I can use? Alternately, is there some way of setting the root password at this point?

For sudo, once I get past being able to log in as root, I will need to find the Mac OS X equivalent of what in Linux would be /etc/sudoers. Where does this live on the Mac?

Thanks!
 
Joined
May 11, 2006
Messages
140
Reaction score
2
Points
18
Location
South Florida
Your Mac's Specs
20" Intel iMac, 15" Powerbook G4 (sold), 20GB iPod (nearing death)
There may be a different way to do it than this, but trust me...it works. And you can look and ask around, it does work:

Get your OSX restore/install and put it in. Click on Install Mac OS. You'll be asked to restart. Do it. You're not going to resinstall, just keep going through windows of the installer until you get to one called utilities or something. one of the choices is reset password. change the password to something you know and then quit the installer.
 

rman


Retired Staff
Joined
Dec 24, 2002
Messages
12,637
Reaction score
168
Points
63
Location
Los Angeles, California
Your Mac's Specs
14in MacBook Pro M1 Max 32GB 2TB
Your admin pass word should work with sudo. To use su you would need antohter user. As you said with root. The root user is disabled by default with OS X. You will have to enalbe root and give it a pass word to be able to su to it.
 
OP
mac57
Joined
Apr 29, 2006
Messages
4,576
Reaction score
378
Points
83
Location
St. Somewhere
Your Mac's Specs
Mac Studio, M1 Max, 32 GB RAM, 2 TB SSD
So, the root user ID doesn't exist at all? That would be consistent with what I see in the Users preference panel. This is just fine if I can set up a sudoers file somewhere, so that I don't have to go through the password challenge/response for every "sudo" based command. Is there a Mac OS X equivalent of sudoers?
 
Joined
Jan 8, 2005
Messages
2,789
Reaction score
84
Points
48
Location
A religiously oppressed state
Your Mac's Specs
17" MacBook Pro
Navigate to /Applications/Utilities and open NetInfo Manager. Select Security > Authenticate and type your administrator password (login password). Now go Security > Enable Root User, from there it will be pretty obvious. To disable the root user (suggested when you are done) open NetInfo Manager again, authenticate and then disable the root user from the Security menu.

--Cheers
 
J

JunMacTech

Guest
mac57 said:
So, the root user ID doesn't exist at all? That would be consistent with what I see in the Users preference panel. This is just fine if I can set up a sudoers file somewhere, so that I don't have to go through the password challenge/response for every "sudo" based command. Is there a Mac OS X equivalent of sudoers?

Are you logged in as an administrator when you are trying to use sudo? All users with admin privs should be in the sudoers list by default. You shouldn't be prompted for a password.
 
OP
mac57
Joined
Apr 29, 2006
Messages
4,576
Reaction score
378
Points
83
Location
St. Somewhere
Your Mac's Specs
Mac Studio, M1 Max, 32 GB RAM, 2 TB SSD
Thanks all. When I am being prompted for the sudo password, I have just opened a Terminal window and typed "sudo some-command". There is only one user on this machine, and that is me. I do have admin priveledges - I am asked for the password from time to time on software installs and it works. Based on what you said, I should be in the sudoers file then?
 

rman


Retired Staff
Joined
Dec 24, 2002
Messages
12,637
Reaction score
168
Points
63
Location
Los Angeles, California
Your Mac's Specs
14in MacBook Pro M1 Max 32GB 2TB
If I remember correctly, being in the sudoers file will only allow you to use the sudo command. You will always have to enter the pass word when using it.
 
Joined
Jan 8, 2005
Messages
2,789
Reaction score
84
Points
48
Location
A religiously oppressed state
Your Mac's Specs
17" MacBook Pro
rman said:
If I remember correctly, being in the sudoers file will only allow you to use the sudo command. You will always have to enter the pass word when using it.
That is correct.
 
Joined
Oct 10, 2004
Messages
10,345
Reaction score
597
Points
113
Location
Margaritaville
Your Mac's Specs
3.4 Ghz i7 MacBook Pro (2015), iPad Pro (2014), iPhone Xs Max. Apple TV 4K
TBoblp said:
There may be a different way to do it than this, but trust me...it works. And you can look and ask around, it does work:

Get your OSX restore/install and put it in. Click on Install Mac OS. You'll be asked to restart. Do it. You're not going to resinstall, just keep going through windows of the installer until you get to one called utilities or something. one of the choices is reset password. change the password to something you know and then quit the installer.

On 10.4 it's the second install screen (when booted from the DVD) and it's under utilities.

I have the root account enabled on all the Mac in my house.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top