While the System Preferences, and the Accounts pane specifically, let you easily create user accounts in Mac OS X, you may need to do so, at times, from the command line. Doing so requires several steps, but in Panther, this is relatively easy to do.
Creating user accounts from the command line uses the niload (NetInfo load) command together with a few other commands to create the new user's account and all necessary settings. Here is how to do it, creating a new user named Henry James, with a short name of henry.
First, you need to run a command to populate the NetInfo database with the appropriate information for a user account. The following command uses the niload command to load information directly into NetInfo. It uses the format of a standard passwrd file, which is that of a series of fields separated by colons (the $ is just the command prompt; don't type it):
$ echo 'henry::512:512::0:0:Henry James:/Users/henry:/bin/bash'
| sudo niload -v passwd /
The above is one long line with a space replacing the line break. It's been shown on two lines for a narrower page display.
$ sudo passwd henry
Changing password for henry.
New password:
Retype new password:
Next, you need to create a group for the user; Panther uses individual groups for each user, which have the same GID as the user's UID:
$ echo 'henry:*:512:henry' | sudo niload -v group /
This command creates the group named henry, gives it the GID of 512, and adds the user henry to the group, all in one step. Finally, you may want to make the user a member of the admin group so they have administrative access. Run this command to add the user to the admin group:
$ sudo niutil -appendprop / /groups/admin users henry
If you do this, your new user is an administrator and has all administrative rights. You can always change this later in the Accounts preference pane. Note that after you have created the new account, the new user does not yet have a home directory. All you need to do is log in under the new user's account, and the system creates the actual home directory at first login. This directory is created from a directory template found in /System -> Library -> User Template.
Mac OS X Hints
http://hints.macworld.com/article.php?story=20041102091117883