Unhide/Delete a User Account?

danshaw
Contributor II

If I create a hidden account with the JAMF binary below, how can I delete the account or how can I unhide it?

This is how I create it:

sudo jamf createAccount -username localadmin -realname Local Admin -password P@ssw0rd -admin -hiddenUser

This creates an account in /private/var/localadmin

I have then tried to change the ID and or deleting it with DSCL, but I keep getting an error.

sudo /usr/bin/dscl . -delete /private/var/localadmin

delete: Invalid Path
<dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)
1 ACCEPTED SOLUTION

franton
Valued Contributor III

That's because where the user account is in the database is not where the folder itself is located!

Try the following:

sudo /usr/bin/dscl . -delete /Users/localadmin

View solution in original post

4 REPLIES 4

franton
Valued Contributor III

That's because where the user account is in the database is not where the folder itself is located!

Try the following:

sudo /usr/bin/dscl . -delete /Users/localadmin

danshaw
Contributor II

Doh! You're right @franton. I thought all hidden users went into /private/var in the database also. Thanks for setting me straight.

garethskwarczek
New Contributor

Just came across this thread and it's saved what little hair I have from being ripped right out. I'm new to JAMF and scripting, so thanks for the script.

Thanks

bonzai_PB
New Contributor

Trying too delete user/admin account, which took over my admin control, in terminal and it wants a password