Mac OS X gain root/superuser access using sudo

Home -> Apple Mac -> System administration

26915 views

From the computer of: macster (14 recipes)
Created: Sep 21, 2004


0 comments:
View all comments

Add a comment

Add to:
Add to stumbleuponAdd to del.icio.usDigg itAdd to FURL

The command line utility sudo is a wonderful way to provide fine-grained access control to different applications to different users. In this recipe, sudo will be used to easily gain full root/superuser access to a Mac running OS X.

Under Mac OS X, the root or superuser account is not enabled following installation. While it is possible to enable the root account, it is safer and potentially easier to use the sudo command to gain root access to the system.

From a terminal window, type

sudo -s


This will prompt you for a password which is the user's password, not the root password (which will not be set). The first time you run sudo, it will print a conscience-oriented message before prompting for the password. Subsequent uses of sudo for that user will not print out that text. The -s option launches a shell as the target user (root). When successfully executed, the shell's prompt should end with root#.

When done with root privileges, it is a good idea to demote yourself and return to your original user shell by typing:

exit

Subscribe to the Tech-Recipes Newsletter

You can get tips like this delivered in your email every week!

Enter your Email

We will never, ever sell your email address or spam you.





Related recipes:

  OS X: Edit a file using TextEdit as root or superuser
  Mac OS X monitor messages during boot
  OS X Leopard: Create new user account with parental controls
  Mac OS X change the default web browser
  OS X: Change your PATH environment variable
  Mac OS X enable fast user switching
  OS X: Easily edit hidden configuration files with TextEdit
  Setup Mac OS X host to print to Windows shared printer
  Mac OSX: Delete a user account
  Mac OS X install gcc compiler

 

Sponsored links

 

Login

Nickname

Password

Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.