9

As soon I bind a Mac to the AD Domain, I usually log into the Mac with the user account.

Of course, under System Preference, User & Groups, the user account is marked as: Managed, Mobile

My second step, is to make the user an Administrator account because I want to allow him/her to install/remove stuff from her/his Mac.

So, with the GUI, System Preferences > Users & Groups > I select the user name and I check mark the option: enable Allow user to administer this computer and I restart the machine and everything works fine. The user now is an Admin for that machine.

Question, how do I perform the above process with the command line in Terminal? Not the bind process, but to make the user Admin for that specific machine.

9
sudo dscl . -merge /Groups/admin GroupMembership username

where ‘username’ is the username of the user you would like to make an admin.

sudo since making changes like this requires elevated privileges.
dscl is the Directory Service command line utility.
. is the local machine.
-merge allows you to add a new key to a record path.
/Groups/admin is the record path for the key.
GroupMembership is the key you would like to assign a value.
username is the value for the key.

  • I've always used dscl . -append /groups/admin GroupMembership USERNAME and it seems to work for me. – IconDaemon Jan 12 '17 at 23:44
  • @Icon I guess ‘append’ is more syntactically correct, but both should work. I've edited my answer to use that though, thanks. – grg Jan 12 '17 at 23:46
  • sudo dscl . -merge /Groups/admin GroupMembership username Use merge is prefered over append – user257289 Sep 27 '17 at 9:27
  • According to the dscl man page, merge will create the the property if it doesn't already exist, and then append the value, while append will only append if the property already exists. – Doug Apr 2 '18 at 23:03
  • @Doug Thanks for this info, you can edit this info into the answer since I think it is important to be included. – grg Apr 2 '18 at 23:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .