Linux/Unix Groups!! How and Why?
This is a completion to the previouse article chmod vs chwon.
Usually, at work or with my personal project, you set up groups to create a framework of permssions of who can do and don't.
And its quite simple (well, not really).
To find a whole list of groups you can open the file /etc/group This file holds current/default information about groups in your system. And head up, groups have IDs and all IDs under 500 are used up by the system usually.
There are so many uses and commands to be used with groups, we will focus on how to create and manage them.
UID Vs GID
Two important IDs that should be mentioned; User ID (UID) and Group ID and best left for the system to assign them, for more advance application of these ID, application can be excited using certain UID which might give access to non-admin users to roots. However when using addgroup and adduser we will ignore the --uid --gid and let the system assign the IDs.
Creating & Managing Groups
addgroup: Add new groups to the system.
adduser: Add user to the system as well as groups.
So lets try it:
A developers' group with A GID 1001. Simple enough, to add user which already exist to to it, simply do this:
sudo usermod -a -G developers abdulrehman
The user would need to logout to get the new group assignment activated.