Solaris

On Solaris, providing you are not using NIS or NIS+, use the /etc/group file to work with groups.

Creating a group

The file /etc/group file will hold group information.

To create a new group, type the following command:

groupadd group-name

Where group-name is the name of the group.

Adding a user to a group

To add a member to a supplementary group, execute the usermod command and list the supplementary groups that the user is currently a member of, and the supplementary groups that the user is to become a member of. For example, if the user is a member of the group groupa, and is to become a member of groupb also, the following command is used:

usermod -G groupa,groupb user-name

Where user-name is the user name.

Displaying who is in a group

To display who is a member of a group, look at the entry for that group in the /etc/group file.

Removing a user from a group

To remove a member from a supplementary group, execute the usermod command listing the supplementary groups that you want the user to remain a member of. For example, if the user's primary group is users and the user is also a member of the groups mqm, groupa and groupb, to remove the user from the mqm group, the following command is used:

usermod -G groupa,groupb user-name

Where user-name is the user name.