Tips for finding Knowledge Articles

  • - Enter just a few key words related to your question or problem
  • - Add Key words to refine your search as necessary
  • - Do not use punctuation
  • - Search is not case sensitive
  • - Avoid non-descriptive filler words like "how", "the", "what", etc.
  • - If you do not find what you are looking for the first time,reduce the number of key words you enter and try searching again.
  • - Minimum supported Internet Explorer version is IE9
Home  >
article

KB-3193: How to create a new local account via command line on Mac OS X

Centrify Identity Service, Mac Edition ,  

12 April,16 at 11:19 AM

Applies to: Mac OS X version 10.6 and higher.
 
Question:
 
Is it possible to create a local user account using on Mac OS X only the command line via Terminal or SSH?
 

Answer:
 
Login to the Mac command line (Terminal or SSH) as Local Admin and run the following sequence:
 
dscl . create /Users/username 
dscl . passwd /Users/username account_password
dscl . create /Users/username UniqueID 555
dscl . create /Users/username PrimaryGroupID 80
dscl . create /Users/username UserShell /bin/bash
dscl . create /Users/username NFSHomeDirectory /Users/username 
 
cp -R /System/Library/User\ Template/English.lproj /Users/username 
chown -R username:staff /Users/username 
 
(Optional)
 
dscl . create /Users/username RealName "Display Name"
dscl . create /Users/username hint "Password Hint"
dscl . create /Users/username picture "/Path/To/Picture.png"
 


Notes:
  • The commands could be saved to a script and run (as root).
  • Make sure to use a UniqueID that is not already in use on the Mac system.
  • PrimaryGroupID of 80 creates an Admin user. 
  • PrimaryGroupID of 20 creates a Standard user.

Still have questions? Click here to log a technical support case, or collaborate with your peers in Centrify's Online Community.