Posted: . At: 10:39 AM. This was 8 years 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.

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

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

root@neo:/home/jason# groupadd dept

Then, create our new user with this command.

root@neo:/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.

root@neo:/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 thought on “Create a new group on Linux and add a new user to it easily.”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.