Linux 101 : Linux groups
Instead of individually giving the same access rights to different users , we put them in the same group and give the groups those permissions.
A group is identified by its GID or Group ID, users can be member or one or more groups.
To have a look at the existing group, we could check the "/etc/group" file.
The groups are made up of the below fields:
Remark:
The sign "x" in the password field means that the password is encrypted and safely stored in the "/etc/gshadow" file that can't be accessed by regular users.
To create a group, we use the command "groupadd", for example:
- -g : allows us to give a group a group ID.
- -f : if the group already exists the command exits with success.
To assign a group to a file or directory, we could use the below command:
It could also be any combination of "read", "write" and "execute" rights.
We could also use the below command to modify a group's parameters:
- -g : Change the group's ID.
We could also use that command to change a group's name as below:
- -n : Rename a group.
To delete a group, we use the below command. It does not delete the members of the groups, but they would lose the access privilege they had through the group they belonged to:
Comments