# Reset dscl UniqueID and PrimaryGroupID of root to 0



## uldispie (Dec 7, 2011)

I am on Snow Leopard. Because of a faulty script my root's PrimaryGroupID is 101 and UniqueID is 101. I have still an access to root, I can run sudo from my admin account, but the sudo and root do not have all the necessary rights obviously.

I can read dscl output, for instance:

dscl . -read /Users/root PrimaryGroupID
PrimaryGroupID: 101

dscl . -list /Users UniqueID
root 101

dscl . -list /Groups PrimaryGroupID
wheel 0

But I cannot change anything with dscl:

sudo dscl . -change /Users/root UniqueID 101 0
<main> attribute status: eDSPermissionError
<dscl_cmd> DS Error: -14120 (eDSPermissionError)
What is interesting, when I run:

dscl . -read /Groups/wheel GroupMembership
GroupMembership: root

How can I reset the UniqueID and PrimaryGroupID of the root to 0. I logged in Terminal through Mac OS X Installation DVD, I have a superuser with all the necessary rights there, but I did not figure out how to access the records of Directory Service from there.


----------



## uldispie (Dec 7, 2011)

I got the answer on serverfault forum. The file we are interested in is located at this path /Volumes/<bootvolume>/var/db/dslocal/nodes/Default/users/root.plist

Start Mac OS X Installer, open Terminal and edit that file. Change the relevant .plist values to 0.

<key>uid</key>
<array>
    <string>101</string>
</array>


----------

