To change file access rights in Linux, the chmod (change mode) command is used. It allows you to change read, write, and execute permissions for the owner, group, and other users.
of the chmod command [options] file rights
Options:
-R - recursively change permissions for all files and folders in the specified directory
-v - output information about each change of rights
-c - displays information only about files whose permissions have been changed
Rights:
r - reading
w - record
x - execution
The action can be one of two things, either add - the "+" sign, or remove - the "-" sign. As for the access rights themselves, they are similar to the output of the ls utility.
For example, all users have full access to the test5 file:
Or we will take away all rights from the group and other users:
Let's give the group the right to read and execute:
For other users, read only:
For the test6 file, set the SUID:
And for test7 - SGID:
Let's see what happened:
As you can see, everything is simple.