Under most flavors of Unix, it’s quite easy to add a user to a group. You just edit the /etc/group file and it’s done. You cannot do that under Mac OS X. OS X introduced NetInfo database. The files are in binary format and you cannot just edit the database files. There is a utility called NetInfo Manager to take care of that.
Recently, one user recovered her PowerBook by herself. During the process, the NetInfo database got erased, a new one was created. She didn’t create the new account to match the old account name. Therefore, when she finally get on the machine using the newly created account, she has no access to her old files. Also, one application reqires the user name matches the old user name.
I used NetInfo Manager to change the new user’s name and home directory. She can see her old files and preferences, also she can use that application again. However, there is one problem. I forgot to update the admin group for the modified user name. The modified account is now a regular account and it’s the only account on the machine.
Apparently, I cannot do any admin tasks using the only regular account. How can I modify the admin group without using any of those GUI utilities?
Later, I learned that I can use nicl to manipulate the NetInfo database and it’s also available under single user mode. Here are the steps.
- Boot the machine to single user mode by holding down Command(Apple icon)+S during booting process.
- Type the following to mount the drive with read/write access.
mount -wu /
- Type the following to add uruser to the admin group.
nicl -raw /var/db/netinfo/local.nidb -append /groups/admin users uruser
- Type reboot to boot the machine.
This post may contain affiliated links. When you click on the link and purchase a product, we receive a small commision to keep us running. Thanks.