The statement to modify permissions in Linux is "chmod [-R] permission value file or directory name"; this statement can modify the permissions of the specified file. The chmod command is a command to control the user's permissions on the file. The setting of permissions Methods can use text or numerical codes; file calling permissions can be divided into file owners, user groups and other users.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
Linux chmod (full English spelling: change mode) command is a command to control user permissions on files
Linux/Unix files The calling permissions are divided into three levels: file owner (Owner), user group (Group), and other users (Other Users).
Only the file owner and superuser can modify the permissions of a file or directory. You can use absolute mode (octal number mode) and symbolic mode to specify file permissions.
Usage permissions: all users
Syntax
chmod [-cfvR] [--help] [--version] mode file...
Parameter description
mode: permission setting string , the format is as follows:
[ugoa...][[ -=][rwxX]...][,...]
where:
u means The owner of the file, g represents the person who belongs to the same group as the owner of the file, o represents other people, and a represents all three.
means adding permissions, - means canceling permissions, = means setting only permissions.
r means readable, w means writable, x means executable, and X means only when the file is a subdirectory or the file has been set to be executable.
Other parameter descriptions:
-c: If the file permissions have indeed been changed, the change action will be displayed
-f: If the file permissions cannot be changed, do not Display error message
-v: Display detailed information about permission changes
-R: Make the same permission changes to all files and subdirectories in the current directory (that is, change them one by one recursively) )
--help: Display auxiliary instructions
--version: Display version
The example is as follows:
Set the file file1.txt to everyone Readable by all:
chmod ugo+r file1.txt
Set the file file1.txt to be readable by everyone:
chmod a+r file1.txt
Set the files file1.txt and file2.txt as the owner of the file, and with them People who belong to the same group can write, but others cannot write:
chmod ug+w,o-w file1.txt file2.txt
Recommended learning: Linux video tutorial
The above is the detailed content of What is the statement to modify permissions in Linux?. For more information, please follow other related articles on the PHP Chinese website!