How to gain root access to Mac OSX

From s23
Jump to navigation Jump to search

Mac OS X: get root access or reset root password[edit]

  • find out your username if you are an unprivileged user by opening Finder:Applications:Terminal: your username is the string right before the $-symbol
  • shutdown your mac
  • push the power-button and immediately press cmd(the apple-key)+s to enter single-user-mode
  • mount the root-filesystem in r/w mode by typing: "mount -uw /"
  • type "visudo" (--> vi)
  • go to the lines starting with root and %admin and press "dd" on both of them
  • press i to enter insert mode and add the following lines:
    • root ALL=(ALL) NOPASSWD: ALL
    • %admin ALL=(ALL) NOPASSWD: ALL
    • YOURusernameYOUfoundOUT ALL=(ALL) NOPASSWD: ALL
      • (where you need to put a TAB-character between e.g. root and the first ALL - and between (ALL) and NOPASSWD: - and a space-character between NOPASSWD: and ALL
  • press escape to exit input mode and enter the ":" character by pressing shift and ; on an english keyboard or shift and . on a german keyboard to enter command mode
  • enter "x" and press enter to save and close
  • enter reboot to reboot the machine
  • once you're back in standard OSX open the terminal application again (Finder:Applications:Terminal) and enter:
    • sudo passwd YOURusernameYOUfoundOUT
      • enter your new password, press enter and enter it again to confirm it
    • sudo passwd root
      • enter the same new password again, press enter and confirm it
  • now, if you like, you can open "System Preferences", go to "Accounts" and click the lock-symbol at the bottom left of the System Preferences dialog, authenticate with username: root and your new password and give YOURusernameYOUfoundOUT admin privileges by checking the "allow user to administer this computer" checkbox

you now have admin privileges with your user and the ability to add new users to the system, change all settings, install software etc.[edit]