0

While working on a yosemite box I found that two user groups had GID value below 0.

$ dscl -plist . -readall /Groups PrimaryGroupID

<dict>
    <key>dsAttrTypeStandard:PrimaryGroupID</key>
    <array>
        <string>-2</string>
    </array>
    <key>dsAttrTypeStandard:RecordName</key>
    <array>
        <string>nobody</string>
        <string>BUILTIN\Nobody</string>
    </array>
</dict>
<dict>
    <key>dsAttrTypeStandard:PrimaryGroupID</key>
    <array>
        <string>-1</string>
    </array>
    <key>dsAttrTypeStandard:RecordName</key>
    <array>
        <string>nogroup</string>
    </array>
</dict>

Is it valid? Does it have a special meaning?

1

User and group IDs are unsigned, i.e. always positive. However, on two's-complement systems, a signed value -1 is represented in the same way as the largest possible unsigned value – 65535 (0xFFFF) in 16-bit fields, 4294967295 (0xFFFF'FFFF) in 32-bit fields.

In some operating systems the "nobody" user has the largest possible UID – not special in the OS, merely chosen as the complete opposite to root having 0. Some programs choose to write this UID as -1 or (uid_t) -1 instead of 4294967295.

(This does cause confusion when other programs use the same value to mean "no UID set"...)

| improve this answer | |
  • thanks, make sense for -1. Any idea about the -2 ? Meanwhile i also found it on userID's (nobody) – mh-cbon May 27 '16 at 14:43
  • That's the same thing. – user1686 May 27 '16 at 15:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.