AirV's Blog

Just another blog

How to add a user from the MacOs command line

From osxdaily.com

Create a new entry in the local (/) domain under the category /users.
dscl / -create /Users/toddharris

Create and set the shell property to bash.
dscl / -create /Users/toddharris UserShell /bin/bash

Create and set the user’s full name.
dscl / -create /Users/toddharris RealName "Dr. Todd Harris"

Create and set the user’s ID.
dscl / -create /Users/toddharris UniqueID 503

Create and set the user’s group ID property.
dscl / -create /Users/toddharris PrimaryGroupID 1000

Add to another group
dscl / -append /Groups/admin GroupMembership rozec

Create and set the user home directory.
dscl / -create /Users/toddharris NFSHomeDirectory /Local/Users/toddharris

Set the password.
dscl / -passwd /Users/toddharris PASSWORD

or

passwd toddharris

If you would like Dr. Harris to be able to perform administrative functions:
dscl / -append /Groups/admin GroupMembership toddharris

Read the user’s information:
dscl / -read /Users/rozec

The local host’s information:
dscl . -read /Users/rozec

Delete the user:
dscl . -delete /Users/rozec

vendredi 26 novembre 2010 Posté par à 13:19 | Apple | pas de commentaire