Create a new group on Linux and add a new user to it easily.

Posted: August 4, 2016. At: 10:39 AM. This was 1 year ago. Post ID: 9508

To add a new group to a Linux system, enter this command as root.

[email protected]:/home/jason# groupadd dept

Then, create our new user with this command.

[email protected]:/home/jason# useradd -m -g dept -d /home/user -s /bin/bash user

Now our user is a member of the dept group.

user@neo:/home/jason$ groups
dept

To add an existing user on a Linux system to a group, use this command.

[email protected]:/home/jason# usermod -a -G jason user

Now we can see that the new user is a member of the jason group as well.

user@neo:/home/jason$ groups
dept jason

That is how easy it is to edit and create user group memberships on Linux. I hope this is very helpful to you.

1 responses to “Create a new group on Linux and add a new user to it easily.

Leave a Reply