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

To change a users login name
usermod -l <new username> <old username>
e.g. usermod -l john.knight john.knoght

“-l” tells usermod that we want to amend the login name.

This is useful if, like me, you made a typo when creating an account 🙂

Add user to supplementary group
usermod <username> -a -G dba
e.g. usermod john.knight -a -G dba

“-a” append the user to the supplementary group, only used with “-G”
“-G” list of groups separated by a comma, or a single group. Must be uppercase.

List the group membership for a user
There are a couple of ways you can check this;

groups <username>
e.g. groups john.knight
would return something like…
<john.knight> :  oinstall dba

id <username>
e.g. id john.knight
would return something like…
uid=35364 (john.knight) gid=35364 (oinstall) groups=35364 (oinstall), 35365 (dba)

Delete a group
If you have created a group which is no longer required, it is easy enough to delete it.

groupdel <group name>
e.g. groupdel oldgroup

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.