What is the statement to modify permissions in Linux?

WBOY
Release: 2022-06-20 17:13:16
Original
10806 people have browsed it

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.

What is the statement to modify permissions in Linux?

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

What is the statement to modify permissions in Linux

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).

What is the statement to modify permissions in Linux?

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.

What is the statement to modify permissions in Linux?

Usage permissions: all users

Syntax

chmod [-cfvR] [--help] [--version] mode file...
Copy after login

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
Copy after login

Set the file file1.txt to be readable by everyone:

chmod a+r file1.txt
Copy after login

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template