Enable root user using the shell command

Discussion in 'Mac Programming' started by Macman1993, May 17, 2008.

  1. Macman1993 macrumors 6502


    Nov 23, 2007
    Hey is there a way to enable the root user using the shell command. I can do this with the directory utility but i would rather just being able to type a bit of code and do it that way.
  2. yeroen macrumors 6502a


    Mar 8, 2007
    Cambridge, MA
    If you want to switch to root, just use sudo. Typing

    sudo su

    switches you to the root user after authenticating with your password. This works even if root is disabled in directory utility. Disabling root in directory utility prevents root logins, in particular remote root logins by a malicious 3rd party (to break into your system, a malicious user would need to know your username as well as your password. If root is enabled, half their work is already done).

    root access is always available to you through the 'sudo' command.

    (Also, disabling/enabling root in directory utility has no effect on programs with the execute bit setuid to root, in case that's why you were asking).

Share This Page