root?

McMendo

Registered
I can't get root on a MacBook Pro that I bought recently. I created a new user on the computer when I started it the first time. I thought that I had created the new user with full privileges, or near.

On an xterm, I can't execute some commands because I don't have the privileges. Not even 'sudo'. I looked at the /etc/passwd file, but there is no root user there.

What's the trick?
 
Root is disabled in MAc OS X as a security measure. When you created the first user, did you make sure that you gave it the ability to administer the computer?

If you need to become root without becoming root, do a "sudo -s" and then supply your user password. You'll get dropped to a "#" prompt.

Ubuntu Linux also follows this measure similarly.
 
You know, after all of these years using OS X and linux I never knew of the -s option... that makes my life so much easier hahaha...
 
:D

ANother one I found out for Linux was the "su -" command (note the sole dash after the "su"). This logs you as root as if you had logged on from the login prompt. Very useful especially when installing CMS software or MySQL database information. ;)
 
And that's not the same as "sudo -s"? I thought they had the very same result. Or are things you do logged under your username when you're obviously "root" by going to the root shell with "sudo -s"?
 
sudo -s keeps your original user environment. You can see this, for instance, if you have very different path settings for root and your user. If this is the case, then

sudo -s
echo $PATH

will show a different value than

sudo -s
su -
echo $PATH

Similarly, if you need to switch to a different user and inherit that user's environment, you say

su - [username]
 
Back
Top