How to gain root access to Mac OSX

Mac OS X: get root access or reset root password

 * 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