Basic User Administration in Solaris

Here are some pointers on performing basic user administration in Solaris, e.g. adding and removing/deleting a user.
The commands useradd, usermod and userdel are available from /usr/sbin when logged in as a user with root privileges.
To Add a User
useradd -u 1001 -d /export/home/timb -m -s /bin/bash -c “Tim Bow” -g 100 timb
-u the numeric user id, must be unique
-d path to users home directory.
-m make the user’s home directory if it does not exist.
-s path to shell.
-c comment, in the above example – the user’s full name. Needs to be enclosed in quotation marks if there are spaces in the comment.
-g group. The group which you wish to add the user to, if –g is not specified then the user will default to group 1.
timb is the users login name.
The above options are only a selection, there are more available – use man useradd to see all options.
To Modify an existing User
To modify attributes of an existing user account you can use the usermod  command. Many of the options used in useradd are applicable although the -l option (login name) cannot be used if the user is currently logged in.
An example of when I have had to use usermod is to correct a type in the user’s comment field:
usermod -c “Correct comment” userid
To Remove a User
userdel timb removes entry from /etc/passwd and /etc/shadow files.
userdel -r timb removes users home directory and login information.
Administer the User’s Password
After creating a new user you should set their password:
passwd timb
If you wish the user “timb” to change their password when they login you can use:
passwd –f timb


Posted

in

by

Comments

One response to “Basic User Administration in Solaris”

  1. […] on from a much earlier post about user administration in Solaris, I have found a few other tasks that may be fairly common […]

Leave a Reply

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