User & Group Management in Solaris
User Management:
There are two types of User;
1. Hard User
2. Soft User
1. Hard User Creation: You must be root (superuser) to add a user. An easy way to
remember the syntax of the useradd command in Solaris is to run it with no
options. Follow the resulting usage information including the parts that you
require. Important options are:
-d home-directory-path
This is the new users home directory, typically /export/home/username
-m
Make home directory and copy the default skeleton files (these files are located
in /etc/skel directory).
-u uid
The uid (userid) is a number from 0 to 65535 which identifies the user on the
system. uid 0 is reserved for root. If you dont specify one, the next available uid
will be used automatically.
-c User Name
Comment field which usually contains the name of the user. Make sure you
enclose the name in quotes if it contains a space.
-s /path/to/shell
The shell to use. If you dont specify this, it will default to /bin/sh. Make sure you
specify the fully qualified path.
So, putting it together, a typical addition of a user named tushar would be:
#useradd -d /export/home/tushar -m -s /bin/ksh -c "tushar" tushar
To set Password:
Use the following command passwd tushar.
To delete Hard User use the below Command;
#userdel -r tushar
2. Soft User Creation: You must be root (superuser) to add a user. However, you
will get limited access to system by using Soft User. Simply use the below
command;
useradd "User Name"
Example: useradd tushar
Passwd tushar (To set password)
To delete Soft User use the below command;
userdel "User Name"
Example: userdel tushar
If you want to change any authorization of any User use the 'usermod' command;
#usermod -s /bin/bash tushar (To change the default shell)
Configuration files:
<!--[if !supportLists]--> i) <!--[endif]-->/etc/passwd user details will be shown here.
ii) /etc/shadow users password will be kept here in encrypted form.
Its a smart idea to run pwck (passwd check) whenever you make a change to
the /etc/passwd file (as when adding or changing a user). This program will
identify any problems with the passwd file. If it doesnt tell you anything, then
you are in good shape.
# vi /etc/passwd
# pwck
Group Management:
There are two types of Group;
<!--[if !supportLists]-->1. <!--[endif]-->Primary Group (one user can assign to
maximum one Primary Group)
<!--[if !supportLists]-->2. <!--[endif]-->Secondary Group (one user can assign to
maximum fifteen Secondary Group)
Use 'groupadd' command to add group called INVAS:
# groupadd INVAS
Create a group called VAS with GID 500:
# groupadd g 500 VAS
Add a user tushar to Primary group INVAS:
# usermod g INVAS tushar
Add a user 'tushar' to Secondary group VAS:
# usermod -G VAS tushar
Change the name INVAS to O&M:
# groupmod -n O&M INVAS
Remove the group called INVAS:
# groupdel INVAS
If you manually modified the /etc/group file then you can check any group file
inconsistencies with grpck command:
# vi /etc/group
# grpck
Configuration file:
/etc/group