Not bad, but still quite a few problems - especially regarding Panther-style users (since this primary hint indicates it is for 10.3): append /groups/admin users $new_username append /groups/wheel users $new_username
create /users/$new_username _writers_passwd $new_usernameĭitto /System/Library/UserTemplate/English.lproj /Users/$new_usernameĬhown -R $new_username:staff /Users/$new_username create /users/$new_username home "/Users/$new_username" create /users/$new_username shell "/bin/tcsh" create /users/$new_username realname "$long_name" create /users/$new_username uid $new_uid
You can then use this same procedure to create multiple users with similarly formatted data in a single text file.Ī second option is to use this shell script:Įcho "Enter the full name for user $new_username's:"Įcho "Will $new_username an Admin user (y/N)?" You can find out a bit more about this command in this article on my site, including more information on the format of data used to create the user. This directory is created from a directory template found in /System -> Library -> User Template. 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. Note that after you have created the new account, the new user does not yet have a home directory. You can always change this later in the Accounts preference pane. Run this command to add the user to the admin group: $ sudo niutil -appendprop / /groups/admin users henryIf you do this, your new user is an administrator and has all administrative rights. Finally, you may want to make the user a member of the admin group so they have administrative access. Run this command, then enter the password twice when prompted: $ sudo passwd henr圜hanging 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. After you've run the command to create the new user, you need to set the user's password. The shell asks for your password, since the second part of the command contains the sudo command, then displays information regarding the additions it has made to the NetInfo database. It's been shown on two lines for a narrower page display. 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. The following command uses the niload command to load information directly into NetInfo.
Here is how to do it, creating a new user named Henry James, with a short name of henry.įirst, you need to run a command to populate the NetInfo database with the appropriate information for a user account. Doing so requires several steps, but in Panther, this is relatively easy to do.Ĭreating 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.
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.