Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How do I enable root user? 10.5

FAQ http://support.apple.com/kb/HT1528
is oblique, and I think, incomplete.
I enter enable and create password according to instructions, but no mention is made what happens after to allow me root access. I notice that a new user is created, but login requires both a name and a password.
I need to access hosts file in terminal and no matter how I try to login, I am not allowed access.

G5 2.7, G4 867 Mirror door, iMac G5 20" 1.25GB, G3 iBook, MacBook 2.4, Mac OS X (10.5.2), A couple iPhones - more than a few deleted posts during iPhone debacle :-)

Posted on Feb 17, 2009 4:20 PM

Reply
32 replies

Feb 17, 2009 8:41 PM in response to Kurt Triffet

Really, the only thing I have found Enabling the root user handy for is carrying out multiple commands
in terminal without having to type sudo in front of every command. Very handy for working inside of
directories that require su permission. Just login in terminal as root after enabling root user.

Be sure to disable the root user after you are done.

Kj

Feb 17, 2009 8:55 PM in response to Kurt Triffet

Kurt Triffet wrote:
That was even easiest. I wish Apple would make something this easy to do a little less hard to figure out in their FAQs.

I guess since they don't expect people to mess with the hosts file on a client machine, there isn't much to explain.

An even easier way to edit the hosts file (you don't even have to be logged in as admin user):
Using TextWrangler (or BBEdit I imagine since TextWrangler is BBEdit lite):
File>Open Hidden…
navigate to /etc/
open the hosts file
Start editing and it will ask if you want to unlock the file
Click Yes
Finish editing and Save.
It will ask for admin authentication.
Done.

Feb 18, 2009 1:44 AM in response to KJK555

Enabling the root user handy for is carrying out multiple commands in terminal without having to type sudo in front of every command


In Leopard Terminal, just create a new tab, issue the "sudo -s" command in there, give your password, and you'll be super user there until you exit.

I have NEVER found any need to enable the root user, and I've been running, and tinkering with, OS X since the first beta. And for someone who is not really really knowledgeable about UNIX, the command line, and so on, I think running a root account is a disaster getting ready to happen. I ought to know--I destroyed enough Linux installs doing just that! 😉

I edit system files fairly regularly. There are several ways to do it, but TextWrangler is no doubt the easiest and most straight-forward. Unless of course you are a UNIX guru who uses vi frequently.
Francine

User uploaded file
Francine
Schwieder

Feb 18, 2009 11:03 AM in response to Kurt Triffet

Contrary to some advice you can probably satisfactorily edit the hosts file by:

1 - put /etc in Finder/Go/Goto Folder and select 'Go'

2 - drag hosts file to desktop

3 - edit it with a text editor but do not remove the first 4 special entries

4 - save

5 - drag it back to /etc

6 - Authenticate with admin user's name and password

This works for me although the file will not have the correct user and group (root and wheel). However, if you later find that this needs changing you can either do it via the Terminal or log in as root and copy (option drag) NOT simple drag the file to the desktop and then replace the original with this copy which will have the correct owner etc.

Perhaps a more experiences person can say why it is considered necessary to have root as the owner of this file.

Feb 18, 2009 11:31 AM in response to KJK555

KJK555 wrote:
It does work, curious though as to how switching shell environment keeps sudo active?

It's not the new tab that does the magic (I never bother to do that), it's the sudo -s, which gives you a new shell as root. You get back to the previous shell, and user, with exit.
It it just a OS X thing or does this work in unix too?

Works in any Unix that has sudo.

Feb 18, 2009 11:35 AM in response to Neville Hillyer

Neville Hillyer wrote:
Perhaps a more experiences person can say why it is considered necessary to have root as the owner of this file.

To stop (or at least make it difficult for) users changing it.

Incidentally, someone (Király) pointed out above that you can fix the ownership by running Repair Permissions after you finish your step 6.

Feb 18, 2009 12:03 PM in response to KJK555

Hi Kj, the "sudo -s" command to make yourself super user has always worked. The difference is just that with the new tabs in Terminal it is really handy to have it going in one tab and your normal self in the other tab, where you can switch back and forth between them by just clicking the appropriate tab. It is probably a security risk to leave the sudo tab going any longer than is strictly necessary though.

Neville: that is basically the way I edit system files. I copy the one I want to the Desktop by drag 'n drop, then open in TextEdit. I can then edit and save to my heart's content. Once I am satisfied with what I've got I put a copy of it in a folder called Mods, by Save as, and amend the name to something along the lines of "foomine" and drag 'n drop the original to the Mods folder as well, so I have copies of both "foo" and "foomine" in case I change my mind about something, or the modification doesn't work.

However, doing this messes up the ownership. You can drag your modified version off the Desktop back to the original location, authenticate to replace the original, and then run Repair Permissions from Disk Utility. Faster is to use Terminal with a sudo chown command. Thus if you modified the hosts file, you would need to change the owner back to root and the group back to wheel.

sudo chown 0:0 /private/etc/hosts

I use the Uid and Gid numbers because I get confused by the "system" vs "root" business and numbers aren't subject to linguistic ambiguity. And as to "why it is considered necessary to have root as the owner of this file"--it isn't necessarily required, but the file is supposed to belong to root so that ordinary users can't mess with it, and when a process calls for it the process can use it as intended. My brother once pointed out that if absolutely everyone has read and write permissions to something it will work. It won't be secure, but it will work. In this particular case it will work, because the file only needs to be read, and the read permissions allow everyone (and thus every process) to read the altered file, even with incorrect ownership.

But if you get used to TextWrangler, that is still the easiest way to go.
Francine

User uploaded file
Francine
Schwieder

Feb 18, 2009 1:11 PM in response to Francine Schwieder

Francine

According to my tests hosts still works with read/write for myself and no access for everybody. However I have not tested for use by others. Any thoughts? As you may recall I now use a launchd-user.conf file set to umask 077 but this does not control root owned files copied to my desktop so I had to set it explicitly for this test.

Feb 19, 2009 9:27 AM in response to Neville Hillyer

Could be one of two things is my guess: either the process that uses the file is yours, in which case there is no problem, but no other user would be able to access the file, since the process would then be theirs and their process wouldn't be able to read the file, or the process might be one of the SUID deals, where it can assume root permissions when necessary, in which case it can read anything it needs to, regardless of the owner of the file, just as giving yourself root permissions with a sudo command will allow you to read other users' files.
Francine

User uploaded file
Francine
Schwieder

Mar 4, 2009 12:23 AM in response to Francine Schwieder

Really hoping someone can help!!! I inadvertantly changed permissions on my startup volume for "Everyone" to "No access". Now I can't do ANYTHING! Can't change it back, either, because I no longer have permission. I need to find a way to reset the permission for the startup volume. Was hoping I could do it by logging in as Root or by using sudo in Terminal. However, I've never used terminal, so I wouldn't no what command to type to change my setting back to "Read/Write, Read/Write, Read Only." Can anyone PLEASE help??? Also, can no longer boot from this volume, although I can boot from an external backup drive that is still running Tiger (as opposed to the recently installed Leopard).

How do I enable root user? 10.5

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.