Convert Standard User Account to Administrator Account from Command Line of Mac OS
From Standard to Administrator - Hack Mac
Restore Admin Privileges
This procedure should restore admin privileges to an account that has lost those privileges. This procedure is only needed if you don’t have another account that has admin privileges.
Section One
Boot Using Command+R keys:
1. Restart the computer.
2. Immediately after the chime press and hold down the "COMMAND" and the "R" keys together.
3. Release the keys when the Utilities Menu appears.
If you use FileVault 2 then open Disk Utility, select the protected volume and click on the Unlock button in the toolbar. You will be asked for your admin password. Quit Disk Utility.
Open Terminal from the Utilities menu in the main menubar. At the prompt enter the following command:
resetpassword
Press RETURN.
A window opens to Reset Password. Select your startup volume. From the menu labeled Select the user account select System Administrator (root). Follow the prompts for setting a password. Be sure you write down the new password so you don’t forget it.
Now, from the menubar select the Restart… option.
Section Two
If you are using FileVault then log in as usual, then select Log Out… From the menubar or press SHIFT-COMMAND-Q. Don’t RESTART. You will be returned to the Login screen.
At the login screen click Other… Enter root in the Name field. Enter the password you set up from Section One in the Password field. This should have you logged in as the “root” user. While in “root” be careful what you type or enter. Carefully follow these instructions.
Open Users & Groups preferences panel. Select your normal administrator account from the list of users and check the box labeled, Allow user to administer this computer. You will be prompted to restart. After the login window appears log in as yourself—not as root.
Your administrator status should now be restored.
Section Three
You should disable the root user if you enabled it. Follow the instructions in OS X Mountain Lion- Enable and disable the root user under the heading, “Disable the root user.” You will be asked to authenticate in Directory Utility as root with the password you set in the first section. The linked article also works in Mountain Lion and Yosemite.
Here is another procedure that will create a new Administrator account, if you don't have one to use.
How to Create a New Admin User Account, if You Have None
Reboot the computer. At or before the chime, press and hold down the COMMAND-S keys to start into Single-user Mode. You will boot to a black screen with scrolling white text, release the keys and wait until it finishes. Enter the following lines at the command prompt pressing RETURN after each:
mount -uw /
^ ^ Note spaces
rm /var/db/.applesetupdone
^ Note space
reboot
After you reboot the computer you will be taken to the Setup Assistant. When you get to the point where you are asked to set up your new user account, create a new admin account. Be sure to name this user account something different than any other account that already exists on the system. When you finish the Setup Assistant, it will automatically log you into the new account.
You need do nothing more. Log into the Admin account only when you need to, such as installing or upgrading software. Log into the Standard account for your normal computer uses. If you prefer using just one account, the admin account, then you will need to make some changes as discussed below.
You can transfer your files from the old account to the new one. See Transferring files from one User Account to another. Once you have moved all your files into your new account, you can delete the old account using Accounts or Users & Groups preferences.