Accidentally deleting all OSX users using dscl
- by gutch
OK, so I just did something really stupid and deleted all the user accounts on an OSX 10.6.6 machine by running this:
sudo dscl . -delete /users
What I actually wanted to do was delete a single, troublesome account using a command like this:
sudo dscl . -delete /users/localadmin
...but I absent-mindedly pressed return too early and deleted the lot. I've tried using -list and can confirm that I have indeed wiped all the accounts. The machine is currently running fine, but I'm sure that once I log out / reboot then it will be completely broken.
I don't mind that I've deleted the normal user accounts (there was only one I wanted anyway). But it's surely going to be a big problem that system accounts like _installer and _jabber and _lda and _windowserver etc etc are gone.
So my question is, how can I restore the standard set of system accounts? Do I have to reinstall OSX from scratch? Or can I either:
undelete those system accounts, or
run some command to recreate the system accounts?