05.12.2023
23:24
To change file access rights in Linux, use the command chmod (change mode). It allows you to change read, write, and execute permissions for the owner, group, and other users.
Command syntax
chmod [options] file permissions
Options:
-R- recursively change permissions for all files and folders in a specified directory-v- output of information about each change of rights-c- display information only about files that have had their permissions changed
Rights:
r - reading
w - entry
x - fulfillment
Examples
The action can be one of two, 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:
chmod ugo+rwx test0
Or take away all rights from the group and the rest of the users:
chmod go-rwx test0
Give the group the right to read and execute:
chmod g+rx test0
The rest of the users are read-only:
chmod o+r test0
Set SUID for file test6:
chmod u+s test1
And for test7, it's SGID:
chmod g+s test2
Let's see what we got:
ls -l
As you can see, it's simple.
15% discount on new VPS
Hurry up to order a server in any location
Other articles
05.12.2023
38 413
Knowledge base / Information
05.12.2023
6 853
Knowledge base / Commands
05.12.2023
16 677
Knowledge base / Programs
