Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > Root Access

Root Access
Thread Tools
Fresh-Faced Recruit
Join Date: Nov 2003
Status: Offline
Reply With Quote
Feb 19, 2004, 06:17 PM
 
I purchased my 1.25 Powerbook refurbished from the Apple store. I have to learn my way around UNIX (specifically HP-UX) for work, so I was screwing around with the terminal. It will not accept my password for root access. Is there a default that comes from the factory? Is it possible that the person before me set root and now I'm screwed?
     
Professional Poster
Join Date: Oct 1999
Location: :ИOITAↃO⅃
Status: Offline
Reply With Quote
Feb 19, 2004, 08:00 PM
 
OS X doesn't have the root account enabled for login by default (i.e. there is no root password per se).

To run things as root, do
sudo command
where command == whatever you want to accomplish

To open a shell as root, do
sudo -s

Depending on your Unix expertise, you might look at
Learning Unix for Mac OS X Panther
or
Mac OS X for Unix Geeks
     
Mac Elite
Join Date: Feb 2001
Location: Washington, DC
Status: Offline
Reply With Quote
Feb 20, 2004, 12:56 AM
 
There are two ways for gaining superuser (root) access in the terminal:

The safest (and preferred) way for OS X is to use sudo as explained above. Just be sure you're using an administrator account first.

The second way is more likely to be supported on multiple platforms, and that's the switch user command, su.

To use su, you need to have your root account enabled, which you can do from inside NetInfo Manager. Simply type in su at the prompt and enter root's password. This will give you a shell as the superuser.

***NOTE: if you decide to enable the root user, it's generally a good policy to never log into your computer as root (and defiantly never remotely). Rather, log in as your normal admin user and switch to a root shell using sudo or su.
/Earth\ Mk\.\ I{2}/
     
DMS Guy  (op)
Fresh-Faced Recruit
Join Date: Nov 2003
Status: Offline
Reply With Quote
Feb 20, 2004, 06:17 AM
 
Thank you both very much. I appreciate it!
     
Grizzled Veteran
Join Date: Nov 2001
Location: Oregon
Status: Offline
Reply With Quote
Mar 9, 2004, 11:59 PM
 
Originally posted by Earth Mk. II:
To use su, you need to have your root account enabled, which you can do from inside NetInfo Manager. Simply type in su at the prompt and enter root's password. This will give you a shell as the superuser.
There is another way to achieve su without enabling root:
Code:
sudo sudo bash Password: bash-2.05a# whoami root
or
Code:
sudo su Password: [Localhost:/Users/me] root# whoami root
There never really is any reason to enable the root user under MacOS X; i've never needed to yet anyhow.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 08:52 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2