I'm a fan of creating users using command line, after I figured out it is so much easier to use adduser in Solaris than to figure how to do it with gui.
useradd -d /export/home/shortname -m -u 501-s /bin/zsh -c "Full Username" shortname
After that passwd shortname and the new user will get the password. + add role.
To keep UIDs in order, I usually start with 501 and then increase them 1 by 1 ... (you already have 0) as I'm used to that scheme...
adduser [Man wiki]
So - it took me a long time to find out an equivalent for adduser in Mac OS X. Man adduser not found, apropos adduser - nothing appropriate ...
Ta-daa! dscl -directory service command line. That is basically adduser for mac.
sudo followed by some of these examples.
Create a new entry in the local (/) domain under the category /users.
dscl / -create /Users/portingunix
Create and set the shell property to bash.
dscl / -create /Users/portingunix UserShell /bin/bash
Create and set the user’s full name.
dscl / -create /Users/portingunix RealName "Porting Unix Applications To Mac OS X"
Create and set the user’s ID.
dscl / -create /Users/portingunix UniqueID 503
Create and set the user’s group ID property.
dscl / -create /Users/portingunix PrimaryGroupID 1000
Create and set the user home directory. (Despite the name NFSHomeDirectory, this is the local path to the home directory.)
dscl / -create /Users/portingunix NFSHomeDirectory /Local/Users/portingunix
Set the password.
dscl / -passwd /Users/portingunix PASSWORD
or
passwd portingunix
To make that user useful, you might want to add them to the admin group.
dscl / -append /Groups/admin GroupMembership portingunix
[ADC Developer notes]
nicl to add user to groups nicl examples
And now back to figuring how to get a bootable installation of Damn Small Linux on my usb memory stick ... when DSL is booted as a VM it does not install it as it should, and I ry to avoid using a Windows machine or trying to figure how OS X commands differ from the Linux 2.4 or 2.6 commands at this hour ...
And some more adds to this :
dscl does not give any errors when done on client .. but it does not seem to do anything on client. Maybe the man page should be better written...
After more days of digging, for Mac OS X non-Server, the syntax for the adduser equivalent would go something like this
Which indeed looks quite long and inefficient way to do it .. maybe that combined in one script, and script named adduser would do the trick. Maybe even the script prompting for the next value...
Still - adduser is practical, and it should be included in OS X client by default.
[niutil syntax]
-- Update : For Mac OS X 10.5, use dscl instead of niutil --
useradd -d /export/home/shortname -m -u 501-s /bin/zsh -c "Full Username" shortname
After that passwd shortname and the new user will get the password. + add role.
To keep UIDs in order, I usually start with 501 and then increase them 1 by 1 ... (you already have 0) as I'm used to that scheme...
adduser [Man wiki]
So - it took me a long time to find out an equivalent for adduser in Mac OS X. Man adduser not found, apropos adduser - nothing appropriate ...
Ta-daa! dscl -directory service command line. That is basically adduser for mac.
sudo followed by some of these examples.
Create a new entry in the local (/) domain under the category /users.
dscl / -create /Users/portingunix
Create and set the shell property to bash.
dscl / -create /Users/portingunix UserShell /bin/bash
Create and set the user’s full name.
dscl / -create /Users/portingunix RealName "Porting Unix Applications To Mac OS X"
Create and set the user’s ID.
dscl / -create /Users/portingunix UniqueID 503
Create and set the user’s group ID property.
dscl / -create /Users/portingunix PrimaryGroupID 1000
Create and set the user home directory. (Despite the name NFSHomeDirectory, this is the local path to the home directory.)
dscl / -create /Users/portingunix NFSHomeDirectory /Local/Users/portingunix
Set the password.
dscl / -passwd /Users/portingunix PASSWORD
or
passwd portingunix
To make that user useful, you might want to add them to the admin group.
dscl / -append /Groups/admin GroupMembership portingunix
[ADC Developer notes]
nicl to add user to groups nicl examples
And now back to figuring how to get a bootable installation of Damn Small Linux on my usb memory stick ... when DSL is booted as a VM it does not install it as it should, and I ry to avoid using a Windows machine or trying to figure how OS X commands differ from the Linux 2.4 or 2.6 commands at this hour ...
And some more adds to this :
dscl does not give any errors when done on client .. but it does not seem to do anything on client. Maybe the man page should be better written...
After more days of digging, for Mac OS X non-Server, the syntax for the adduser equivalent would go something like this
niutil -create . /users/fred
niutil -createprop . /users/fred gid [groupID]
niutil -createprop . /users/fred uid [uniqueNumberOver1000]
niutil -createprop . /users/fred shell /bin/tcsh
niutil -createprop . /users/fred home /Users/fred
niutil -createprop . /users/fred realname "fred jones"
niutil -createprop . /users/fred passwd '*'
mkdir /Users/fred
mkdir /Users/fred/.ssh
chown -R fred /Users/fred
chgrp -R [groupID] /Users/fred
chmod 755 /Users/fred
Which indeed looks quite long and inefficient way to do it .. maybe that combined in one script, and script named adduser would do the trick. Maybe even the script prompting for the next value...
Still - adduser is practical, and it should be included in OS X client by default.
[niutil syntax]
-- Update : For Mac OS X 10.5, use dscl instead of niutil --

Comments
#!/bin/bash
#get the next higher uid for new user
new_uid=`nidump passwd . | awk -F: '{print $3f}' | sort -n|tail -1`
new_uid=`expr $new_uid + 1`
#set group
group='portingunix'
gid=$new_uid #uid and gid are the same in accounts created through gui
#set full and short names for user
fullname='Porting Unix'
shortname='portingunix'
#set password
password='PASSWORD'
#create new group for user
dscl / create /groups/$group
dscl / create /groups/$group name $group
dscl / create /groups/$group passwd "*"
dscl / create /groups/$group gid $gid
dscl / create /groups/$group users $shortname
#create new user and password
dscl / -create /Users/$shortname
dscl / -create /Users/$shortname UserShell /bin/bash
dscl / -create /Users/$shortname RealName "$fullname"
dscl / -create /Users/$shortname UniqueID $new_uid
dscl / -create /Users/$shortname PrimaryGroupID $gid
dscl / -create /Users/$shortname home /Users/$shortname
dscl / -create /Users/$shortname authentication_authority ";ShadowHash;"
dscl / -create /Users/$shortname _shadow_passwd ""
dscl / -passwd /Users/$shortname $password
#create home directory from template for new user and set permissions
cp -R /System/Library/User\ Template/English.lproj /Users/$shortname
chown -R $shortname /Users/$shortname
chgrp -R $gid /Users/$shortname
chmod 755 /Users/$shortname
'dre?