Ubuntu offers you a very simple “User Account” option that does not offers many options. If you are planning on adding User to a Group or Removing user from a group just make sure to thoroughly check out this article.
If you have experience in Linux and you are the administrator, you might come through situations where you would need to add a user to the group. It is very easy adding or removing users to the group via Ubuntu, just stay focussed while going through the article.
Before that, let’s figure out what are the groups that Linux use
Groups that are used for in Linux
In Linux, a Group is just an accumulation of users. The group is basically used for administrating permissions among the number of users.
This concept of Group is used across a Unix-like operating system as a whole apart from Linux platform. A user definitely needs to belong from at least one group and it should be the user’s primary group. A user can also belong to other groups but that falls under the secondary group. Single users associated with many secondary groups and that definitely has a limit.
Rolling on how to add and remove users from a group in a simple manner
How does Ubuntu add users to a group
Before trying to add users to a group, you should know 2 commands in Linux that will help you do that. The 2 commands are groups command and the usermod command.
The first command will show how many groups you are associated with
Run the given instruction:
While you are adding a user to the group, you must confirm if the users exist or not. To check this out use “getent” command and do as said
Run this command and a list of groups will appear on your screen and also show which users are assigned to the groups.
If you want to add a user to a group, just type usermod command and follow as instructed
sudo usermod – a -G group username
The above-written command will replace the old group with the name of the new group and username with the name of the user.
Check out the illustration
sudo usermod – a -G sudo starlight
Creating a new group in Ubuntu
While adding a user to the group, if the group goes missing, you will need to create a group and the groupadd command is needed here.
This command is very simple to run. Just type sudo with the group name you would want to make.
Check this illustration for better understanding
Type sudo groupadd
Then Run It.
This step will create your “newgroup”. I don’t think you will need this in general but if you want to install a few selective softwares you have to create new groups definitely. If you want to add users to your new group, you will have to run the specified instruction given above.
How to remove a user from a Group in Ubuntu
I hope it is clear to you, how to add a user to a group on Linux. When turns of removing a user from a group come, it depends on across Linux Distribution but Ubuntu has really made it easy to remove a user.
Follow the specific instructions to remove a user from a group
While wanting to remove a user from a group smoothly, run the delsuer command. You can use this on both Ubuntu and others like Debian.
sudo deluser username groupname
You have to always make sure that the “groupname” is present in your command. This is to aware, that if you by mistake run the command without the “groupname” , it will just delete the User completely and forever.
Easier way to add and remove users from groups in Ubuntu
It’s completely up to you to figure out which way you want to do these. Some are comfortable with running commands directly and some are used to graphical tools to do the job.
If you wish to make it look cooler, then install the “gnome-system-tools” package. It is very efficient and has a variety of utilities
To install the whole package of “gnome” Run this specified command
sudo apt install gnome-system-tools
You have to answer with a “YES” when asked. Once it is complete, the package will download and install by itself.
When you see the installation has finished, launch the “Users and Groups” application.
After it is launched, look on the left side to get the list of all the users on your system.
To Add and Remove users from groups, go to the “Manage Groups” option.
Now a list of all the available groups will appear in Ubuntu.
You can add users to the Group by going to Properties. Add users by checking the box next to their name icon and delete the users by unchecking the boxes.
Coming to a conclusion
Discussion on Ubuntu Linux: Adding and Removing Users to Groups the Easy Way ends here.
You have to get through the whole process very carefully, any wrong command can land you up in trouble. So, I would recommend you to go through the article again while doing it.