The following will create a user USER_NAME in the group USER_NAME
with a home directory /Users/USER_NAME, it assumes you have sudo
access and are currently in /Users
Find the next free uid by running the following
nireport . /users name uidcreate user, assuming a free uid of 505 from the previous step.
This should be a single line.
echo USER_NAME::505:505:USER_NAME build user:0:0:USER_NAME
User:/Users/USER_NAME:/bin/bash | sudo niload -v passwd /Set password
sudo passwd USER_NAMEcreate group
echo 'USER_NAME:*:505: USER_NAME' | sudo niload -v group /create user directory
mkdir USER_NAMEchange ownership
sudo chown USER_NAME:USER_NAME USER_NAMEmake sure you can login
ssh USER_NAME@localhost
As an aside here is how to delete a user via the command line.
check the user exists
dscl . read /users/USER_NAME
delete the users group
sudo dscl . delete /groups/USER_NAMEdelete the user
sudo dscl . delete /users/USER_NAMEdelete user home directory
sudo rm -rf USER_NAME
Taken from
http://www.mcelhearn.com/article.php?story=2004110211244242
http://www.oreillynet.com/mac/blog/2006/04/deleting_mac_os_x_users_remote.html
http://developer.apple.com/documentation/Darwin/Reference/ManPages/index.html
http://docs.info.apple.com/article.html?artnum=60038
Labels: OSX create user


0 Comments:
Post a Comment
<< Home