/etc/group file contains all groups available on the Linux systems. You can read all groups available with cat /etc/group command. To find out into which linux group you belong to you can use a following linux command:

groups

another way to access your personal group information is with id command:

id

id command will return group names you belong to as well as group numbers. To add a user to a group on your linux systems type ( only as a root ):

# usermod -a -G group-name user-name

Previous command will add user-name user to a group group-name. If the group does not exists you will get a following error:

usermod: unknown group group-name

In this case you can create a new group with ( only as a root ):

# groupadd group-name

There is also another way to add user to a group manually by editing /etc/group file, but this is not recommended.

FIND LATEST LINUX JOBS on LinuxCareers.com
Submit your RESUME, create a JOB ALERT or subscribe to RSS feed.
LINUX CAREER NEWSLETTER
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.

You may also be interested in: