This article outlines how to give an account on Mac OS X administrator privileges, without previous knowledge of the root or an administrator’s password.
We’ll be using Single User Mode (SUM) to gain root access to the computer. If you’re still unfamiliar with SUM, it’s a diagnostic boot option built into Unix that automatically logs you in as the root user, or “super-user”, allowing the usage of unrestricted commands.
- Access to Single User Mode (If you’re locked out, check out our post on how to unlock it.)
1. Power Down
If your computer is on, go ahead and turn it off. To boot into Single User Mode, we need to press a key command as the computer boots up.
2. Power Back Up
Press the power button, and as soon as the computer begins to turn on, immediately and simultaneously hold the Command (Apple) key and the “s” key. This will boot the computer into SUM. Be sure to hold the keys down until the screen turns black and white text scrolls down it.
3. Mount The File System
To make changes to the files, including the “user group” that a user’s account is in (Standard, Managed, or Administrator), we need to mount the file system, because in SUM, the system doesn’t do it automatically. To do this, wait until the white text has stopped scrolling down the screen, then type the following and press enter:
mount -uw /
4. Change The User Group
Once you’ve got the file system mounted, we want to change the GroupMembership of an account. We’ll use the dscl utility to change it with the following command, replacing “username” with the short name of the user you want to give administrator privileges too:
dscl . -append /Groups/admin GroupMembership username
After you’ve executed that command, type:
And hit return.
There you have it! The computer will reboot and start up normally, and you’ve successfully changed the GroupMembership of a Standard user account to an Administrator account.
Just another piece of additional information; in Single User Mode, you can also reset the root password, and be able to use that password as a login when prompted for an administrator password. This will allow you to access things requiring administrator privileges, without your account appearing to be an administrator.
Using the root account can be dangerous, and you can mess up your system if you’re not careful.
Once you’ve booted into Single User Mode, simply enter:
It will then prompt you to enter a new password and confirm it. Do so, and now the root password is reset. You can authenticate any window asking you for an administrator password with the username “root” and whatever you just set the password.
You can now also use the “sudo” command in terminal, or even without the root account if your account is an administrator account (if not, just follow the steps at the top of this article to change it), and change other users passwords with the same command, replacing “user” with the targeted username:
sudo passwd user
If you didn’t make your account an administrator and just changed the root password, but still want to run these kinds of commands, the solution is simple. In terminal, type:
It will then prompt for the root password, and then you will be able to run the above
sudo passwd user command, as well as others.
The contents of this guide are for educational use only. For more information, see our Disclaimer.