Linux is a powerful operating system that is also the most secure platform on the market. With a wealth of security features and subsystems, anyone using this open source operating system can add even more security and privacy with groups.
Groups allow you to control which files and folders users have access to much more efficiently than handling the task one user at a time.
Also: The First 5 Linux Commands Every New User Should Learn
Here’s an example to illustrate what I’m talking about. Let’s say you have 100 users who need access to a directory you created called /data. You could change the permissions on that folder to give anyone permission to access it, but that’s a security risk. Instead, you could create a group called data_users, change the ownership of the folder to data_users, and then add the necessary users to the new group. The beauty of this method is that whenever a user no longer needs access to the folder, all you have to do is remove them from the group.
Before you begin with these tasks, you’ll want to know how to manage groups on your Linux system, and there are five commands you should learn.
Are here.
1. groups
If you want to know what groups a user belongs to, this is the command to use. Simply type the command groups You will see a list of all the groups for the current user. If you need to list the groups for a specific user, the command would be:
Where USER is the username in question.
That’s pretty much all. groups The command does it, but it’s important to know.
2. add group
This is the next command you’ll want to learn because it allows you to add new groups to your system. Unlike groups, groupadd requires? sudo privilege and it also offers some useful options. However, it is not necessary to use any options to create a basic group. In fact, I would recommend not using any of the available options and just running the command as follows:
Where GROUP is the name of the group you want to add.
3. group of
If you need to delete a group, there is a command for that as well, which is groupofOne thing to note is that you cannot delete the primary group of any existing user (because all users are created with a group with the same name, such as user jack and group jack). To delete a group, the command would be:
Where GROUP is the name of the group to be deleted.
4. mod group
He Group Modifier The command allows you to modify a group in the system. Things that can be modified with this command include the group ID, name, and password (which should not be used because the password would be visible to users).
Also: Switzerland now requires all government software to be open source
Change something with Group Modifieryou would issue a command like:
sudo groupmod -n NEWNAME OLDNAME
Where NEWNAME is the new name of the group and OLDNAME is the old name.
5. group of changes
He group of changes The command allows you to change the ownership of the group. It is similar to the command chown command but easier to use (because chown It also takes care of user ownership. Let’s say you have a group called data_users and you want to give all users in that group access to a specific file called zdnet_welcome.txt. The command for that would be:
sudo chgrp data_users zdnet_welcome.txt
At this point, the zdnet_welcome.txt file will be available to all members of the data_users group.
Also: Why aren’t more people using Linux for desktop? I have a theory that you might not like
And that’s it. With these five commands, you should be able to manage your Linux groups with ease.