Mac OS X gain root/superuser access using sudo

Contributor Icon Contributed by macster Date Icon September 21, 2004  
Tag Icon Tagged: Mac system administration

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

Previous recipe | Next recipe |
 

 
close Reblog this comment
blog comments powered by Disqus