Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.5: Delete users accounts from command line in 10.5' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.5: Delete users accounts from command line in 10.5
Authored by: nilness on Jun 11, '09 08:03:41AM

bcmeta-

Copy and paste it into text edit, make sure it's plain text not RTF, then save it as "userreset.sh" or whatever you'd like; just make sure the ".sh" is on the end. And note that if you change the name of the script you'll need to change the script line that deletes itself - use wallybear's suggestion to make it painless.

Put it in the root level of the hard drive, reboot into single user mode, and type "sh userreset.sh" or whatever you named it.

The script will run then delete itself and shut the machine down when it's finished.

wallybear-

Thanks for the input! I'm REALLY rust on shell scripting but figured there was probably an easy way to do this. For our needs the hardcoding is fine but I certainly prefer to have a more flexible solution.

Do you know off-hand if the "id" command and "$0" variable work consistently with 10.3 & 10.4? As you can see I'm trying to keep the script flexible enough to use with all the OS's we're likely to need it with.

Thanks for the help!



[ Reply to This | # ]
10.5: Delete users accounts from command line in 10.5
Authored by: wallybear on Jun 11, '09 01:03:38PM

"Do you know off-hand if the "id" command and "$0" variable work consistently with 10.3 & 10.4? As you can see I'm trying to keep the script flexible enough to use with all the OS's we're likely to need it with."

The $0 variable is a standard for bash/sh, so it works in 10.3 & 10.4 also.
Regarding the "id" command, man states that "The id command appeared in 4.4BSD."; I don't know if it is available in 10.3.x in general, but I can confirm it is from 10.3.9 and later.



[ Reply to This | # ]
10.5: Delete users accounts from command line in 10.5
Authored by: nilness on Jun 12, '09 07:19:29AM

Thanks... of course I just did a little testing and it looks like the id command won't work in single user mode without starting netinfo/directory services. Not a problem for 10.5 since that has to be done anyway, but I guess I'll have to see about starting & stopping netinfo in 10.3 & 10.4. I'm not sure it's worth the trouble - starting to wonder if listing the user directory might be easier!



[ Reply to This | # ]