

Using the information above, let’s take away the read permission for users outside the group and add write and execute permissions to the group as follows: $ sudo chmod g+wx,o-r leads.txt $ sudo chmod g+wx,o-r developers.txt $ sudo chmod g+wx,o-r sre.txt What permission to change: r for read, w for write, x for execute.
#LXFREE USING GROUPS IN ANOTHER FILE HOW TO#
How to change permission: + (plus sign) to add permissions, - (minus sign) to remove permissions or =(equal sign) to leave as is.Whom to change permissions for: u for the user(owner), g for the group and o for all other users.When using this command, we specify the following: To set or change permissions, use the chmod (short for change mode) command (see the manpages for more details). So, considering we want to restrict file access to only members belonging to the file group, let’s change that. However, all other users outside of the group also have read permissions (as demonstrated by the last three characters r-). This means that only members of the group that owns the file can have whatever permissions specified that is, read permission (as demonstrated by the middle three characters r-). Now, when we run the ls -l command, we should get the following output: -rw-r-r- 1 adminuser leads 0 Aug 15 19:41 leads.txt -rw-r-r- 1 adminuser developers 0 Aug 15 19:41 developers.txt -rw-r-r- 1 adminuser sre 0 Aug 15 19:41 sre.txtĮach file now belongs to its respective group. So, for our example, we’ll run the following commands: $ sudo chgrp leads leads.txt $ sudo chgrp developers developers.txt $ sudo chgrp sre sre.txt The syntax for this command is: $ sudo chgrp

To do this, let’s assign group ownership using the chgrp (short for change group) command. We want each file to belong to its own group. With the above information in mind, we will assign a specific group to its related file. root : the user that owns (created) the file.

