Skip to content

Basic User Administration in Solaris

05/04/2011

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

Advertisements

From → Unix/Linux

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: