Linux Add Group

Linux Add Group

 Linux Add Group


Use groupadd or addgroup command to create a new user group in the Linux system.

Syntax:

$ addgroup GROUP_NAME

Example:
Let’s create a group named “testgroup”.

$ addgroup testgroup

Add User to Group

Use usermod command to add user in the secondary group.

$ usermod -G testgroup testuser

You can view the group’s names of the user belongs to.

$ groups testuser

testuser : testuser testgroup 

Assign Group during Create New User

You can also assign a specific group during create creation process. This will also create the primary group

$ useradd -G testgroup rahul
Reactions

Post a Comment

0 Comments

close