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

Click here to return to the 'Create a new user via the Terminal' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Create a new user via the Terminal
Authored by: ssevenup on Jun 05, '03 02:47:15PM

I have been refining my adduser script for many months. It has some elements that are specific to my organization. In general this becomes a much more complicated process than it would first appear. Some things to consider about advantages of this method for adding user accounts...

Apple's GUI does not preserve resource forks when populating the home directory. If you need to customize your builds like we do, this can be a deal breaker. My script uses CpMac (part of Dev tools) to overcome this shortcoming.

Apple's GUI does not allow you to specify a UID or alternate home directory.

I'm not sure if using the tools with OSX Server solve either of these issues, but we don't run a server so it was not important for me to know anyway.

Another thing to consider about command line management of user accounts is the add/remove process for groups. I had to add a lot of logic to search the Netinfo database for duplications. I also needed cleanup code so you don't wind up with users left in the database after they have been removed. or, more importantly, left in one group, but not another.

No script I have found so far (not even mine) has addressed the creation of the config file in /private/etc/httpd/users. The GUI handles this, but none of the scripts do. I plan to work on this eventually. There may be other things the GUI does too that are not obvious.

It's a can of worms, but for many it's one worth opening.


Mark Moorcroft
Sys. Admin.

[ Reply to This | # ]
Create a new user via the Terminal
Authored by: Gigacorpse on Jun 05, '03 08:31:54PM

Wouldn't Ditto have worked? It has a switch to keep the Resource Forks of files.

[ Reply to This | # ]