Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I accidentally force-created a user with the shortname "admin" after my Mac OS X machines already had users with the shortname "admin". What possible remedies are available to me in order to delete all traces of that second, spurious "admin" user?

(Ideally, this would be a command-line op because it needs to be repeated across the multitude of machines that now have an extra "admin".)

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

dscl is the command line utility to maintain OSX's user/group databases. To explore what's there, sudo dscl . to get its command line, then list /Users. To see the definition for a given user, use read /Users/admin. As you might expect, removing it is delete /Users/admin. (There's also a help command.)

For scripting, you can do these from the command line:

 $ sudo dscl . -read /Users/admin

That is, just add a - before the command name.

I'm pretty sure DirectoryService names must be unique, so I assume that your existing admin is admin and the bogus one must be admin␣ or something silly like that. Alternately, you might have one defined in /etc/passwd and one in DirectoryServices; the former will only be used during system boot, before /usr/sbin/DirectoryService is running.

share|improve this answer
    
I'm aware of dscl and have examined the users -- they are identical with the exception of GeneratedUID. –  ZaMoose Mar 22 '11 at 19:58
    
Looks like you can include that GeneratedUUID to select the specific record. dscl . -delete /Users/admin GeneratedUUID mumble. –  geekosaur Mar 22 '11 at 20:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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