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
Page permalink.
WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters. These cookies expire two weeks after they are set.

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