Screen-2BShot-2B2015-06-30-2Bat-2B10.20.42-2BPM

How to add a user in Mac OS using Terminal

Here I will show you the steps to add a user in the Mac OS using Terminal / Command Prompt in simple steps.

1) Open up the terminal window.

2) Create a user by using command:

dscl . create /Users/hadoop
If you get error like:
<main> attribute status: eDSPermissionError
<dscl_cmd> DS Error: -14120 (eDSPermissionError)
Just use the command with sudo access
sudo dscl . create /Users/hadoop
This will create the user hadoop in the system.
3) Set the shell property to bash by using command:
sudo dscl . create /Users/hadoop UserShell /bin/bash
4) Set the real name of the user
sudo dscl . create /Users/hadoop RealName "hadoop"
The real name does not need to match with the user name.
5) Assign a UniqueID to the user:
sudo dscl . create /Users/hadoop UniqueID 503
6) Assign GroupID to the user:
sudo dscl . create /Users/hadoop PrimaryGroupID 1000
7) Provide the home directory of the user:
sudo dscl . create /Users/hadoop NFSHomeDirectory /Users/hadoop
8) Provide password for the user:
sudo dscl . passwd /Users/hadoop PASSWORD
where PASSWORD can be any password for the user.
9) If the Administrator privileges need to be assigned to the user:
sudo dscl . append /Groups/admin GroupMembership hadoop
To get the list of all the users to verify the added user, use command:
dscl . list /users
output:
....
...
daemon
Guest
hadoop
nobody
root
You can see the added user in the list ‘hadoop’

Leave a Reply

Your email address will not be published. Required fields are marked *