user cannot be found in Mac OS X

Posted on

QUESTION :

After running the script in this answer to show all members of the group wheel, I got a weird result.

The user tempuser cannot be found
There was an unknown error.

When I tried dscacheutil -q user -a name tempuser, I got nothing. Grepping for tempuser in /etc/passwd also gives nothing. So what is this tempuser account doing here and how can I get rid of it?

I have a sneaking suspicion that I created it some time ago while testing, but it seems odd that I could create a user account which most of the OS doesn’t seem to know about.

UPDATE: When running dscl . -read /Users/tempuser, I get

AppleMetaNodeLocation: /Local/Default
AuthenticationAuthority: ;Kerberosv5;;tempuser@... ;ShadowHash;...
GeneratedUID: ...
Password: *...
PasswordPolicyOptions: ...
RecordName: tempuser
RecordType: dsRecTypeStandard:Users

In contrast, when running that command on my own account, I get those keys, plus the following keys, which don’t exist for tempuser:

PrimaryGroupID: ...
RealName: ...
UniqueID: ...
UserShell: ...

So somehow I generated a user without an id and that’s why the utilities are complaining?

ANSWER :

I’m not sure how that tempuser account got created, but however it happened it’s missing some critical properties (mostly UniqueID and PrimaryGroupID), so I can’t really blame dscacheutil for getting confused by it. In any case, it should be safe to delete it with:

sudo dscl . -delete /Users/tempuser

Leave a Reply

Your email address will not be published. Required fields are marked *