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 |
 
  • Adrian
    This doesn't work for me

    >sudo -s
    sudo: must be setuid root

    However, I see that /usr/bin/sudo is owned by another user. Is this the problem?
  • Carl
    I don't think this is working for me,

    my shell's prompt ends with back-3.2#


    am I in root access?
  • Carl
    sorry, i meant bash-3.2#
  • Yeah, a prompt ending with a hash # symbol usually denotes root's shell prompt.
  • peterenns
    In order to uninstall, install a particular new program and then reinstall an old program, I need to delete my /sw directory. But, I cannot even figure out how to find a terminal window so that I can use sudo.

    Can anyone tell me how to open up a terminal window so that I can use sudo?
  • Gianpaolo
    Hi,

    I`m trying to copy an Info.plist file into a Volume (The Sims3 Volume) for cracking porpouse. I`ve done everythingo but everytime I get that I can`t because the Sims3 Volume is read-only. I`ve tried to chmod the Volume but i get the same results. It says I can´t because it´s read-only.

    I´m doing all this using a root account

    Any help would be appreciated
  • eugenefromcalifornia
    Response to peterenns:

    Go to Applications->Utilities to find your terminal application.
blog comments powered by Disqus