In the realm of Linux, user groups are an indispensable tool for managing permissions and access control. They offer a way to organize users and allocate privileges to them. This comprehensive guide will walk you through the creation of user groups, assigning group permissions to directories, managing groups, and adding users to groups in Linux.
Creating A Group
Creating a Group in Linux is a very straightforward process, You just have to put the single command line.
sudo groupadd development //group name development
Assign group permissions to a directory
Use chown
command to change the group ownership of the directory.
sudo chown :development /var/www/html
Now the above command will change the permission of that HTML directory.
You can see in the image below: {But before I have added the user to the group will see this in next point}
See all the created Groups Listing
It’s again the straightforward command.
cat /etc/group
Then you can the listing of all groups.
Checking User Group
So, now if you want to check in which group current user belongs to then you can put the simple command.
groups username // in my case {robin}
It will list all the groups.
Conclusion
User groups in Linux are invaluable for managing permissions and access control. By following this comprehensive guide, you can create, assign permissions, and effectively manage groups and users in your Linux system. I hope this article gives you some knowledge of Linux systems.
Thanks For Reading.
Recommended: Automating workflow in Linux systems