Adding Users and Groups via Command Line (Solaris)
(And userstanding UIDs)
1. Login as root (or any account with UID=0) then create the new group:
groupadd myusers (a new entry is created in the /etc/group file)
2. Now add the user:
useradd -g myusers -m -d /usr/daren -c “Daren Matthews” -s /bin/sh -u 102 daren
NOTE:
-g Group Name
-m Make Home Directory (for user)
-d The location of the directory
-s The Shell to use (in this case, the Bourne Shell)
-u If you wish to specify a specific userid (optional)
cat /etc/groups
cat /etc/passwd
cat /etc/shadow (is the user account locked? (“LK”) or does it have no password? (“NP”))
3. Now set the password for the user:
passwd daren
NOW: copy the users profile file to a hidden file (preceded by dot / period (.))
cp /usr/daren/local.profile /usr/daren/.profile
ls /usr/daren/profile (making sure it is created)
rm /usr/daren/local.profile (remove original unhidden file)
4. Verify password for user:
cat /etc/shadow
FOR REFERENCE: UID Values
0 Root User
1 – 100 Internal System Accounts
101 – 60000 Free for use by any user account
60001 Root request from NFS server
60002 Account access by non-logged in user
65534 the “Nobody” account