3 Replies Latest reply: Apr 8, 2011 7:04 AM by BobHarris
zijohn Level 1 Level 1 (0 points)
Hi, All.
As a unix user, I automatically think of the root user when I got my Macbook Air.

I try to su, and it doesn't accept my password.

Is there a default setting on this? How to get my root access?

Thanks.

John

Macbook Air, No backlight
  • Nils C. Anderson Level 4 Level 4 (3,495 points)
    Try using 'sudo' instead. And when prompted type your password.
    if you need a shell that's logged in as root, use 'sudo -s'

    It's been a number of years. But I don't believe that the root password is set.
    The account used to be locked, preventing you from directly logging in as root.
    if you are one of the Admin users on the system, you're allowed to gain
    root privileges.
  • Antonio Rocco Level 6 Level 6 (10,330 points)
    Hi

    Root is disabled by default on OSX Client. For future reference and just in case you wanted to know, it's enabled by default on OSX Server. Root derives its password from what is used for the local admin account. If you've not set a password for that account then root won't work unless you either define a password for that account or enable root and define a specific password for it. Passwords need not be synchronised. You can enable root by simply creating a password for it:
    passwd root

    Follow the on-screen prompts.

    HTH?

    Tony
  • BobHarris Level 6 Level 6 (15,105 points)
    I stopped directly logging into root several years ago, once I got comfortable with the 'sudo' command.

    My Macs have the disabled root password from their installs, and I do not know the root password for the Linux, Solaris, and AIX systems I use. I do everything via 'sudo'.

    If I need remote root privileges (like cron driven network backups), I use ssh-keygen keys in the root's .ssh/authorized_keys file.

    Not having a root password means anyone trying to break in, has to guess both a valid account name AND the account's password. Having a valid root password means they only need to get the password for an account every Unix system has.

    But if you really want to login as root, Antonio Rocco has provided the solution.