User rights and group rights:

  • r : read rights.
  • w : write rights.
  • x : execute rights.



Primary groups (Login groups):

When we create a user, we assign a primary group to him. 
In the example below, we have created a user named Albert using the command adduser.
We need to fill out the information the system prompts us to for setting up the user account. 
Among that information, we find the group information below:



We can have access to a user information, including the group and user identifier using the id command:





Group memberships:

To show all the groups a user belongs to, we use the below command:






User groups :

By default FreeBSD creates a group with the same name as the username, it then assigns that name to the user's login group(primary group) name as we can see in the example above.
We can assign to a user a existing login group, other than the default one.
If the group doesn't exist we can create it using the below command:






Creating a file and associating it to a new group:

To create a file in Albert's home directory /home/Albert, where he has readwrite and excecute rights he(e can create a file there), we follow the steps below: 
  • we switch to user Albert using the su (Switch User) command 
  • We go to Albert's home directory.
  • We create the file Albert_file.

Changing the group ownneship of a file:


PS: 

A file can only belong to one group, to change the group a file belongs to, we use the chgrp command:

Adding users to a group:

The below command pw user creates a new user Tom and adds him to the secondary group New_group as we can see below.
We can use the id command to display the user and group ids and names.



Adding users to a group and overitting the existing ones:

The below command adds users to a group.
If the group has users, the command overwrites them with the new ones:




To add users to the group without overwriting the existing ones:




To be able to see all the members of a particular group, we use the below command:





Brando Sabatini and Ikbal C ©. Powered by Blogger.