Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How linux modifies read-only permissions

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

In this article, the editor introduces in detail "how linux modifies read-only access". The content is detailed, the steps are clear, and the details are handled properly. I hope this article "how to modify read-only access in linux" can help you solve your doubts.

In linux, you can use the chmod command to modify file read-only permissions, which is used to control the user's permissions on the file. Setting the parameter "r" indicates read permissions, "w" indicates writable permissions, "x" indicates executable permissions, and the syntax is "chmod [- cfvR] [--help] [--version]".

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

How to modify read-only permissions for linux

The Linux chmod command is a command that controls the user's permissions on a file.

Only file owners and superusers can modify the permissions of a file or directory. You can use absolute mode (octal number mode), and symbolic mode specifies the permissions of the file.

Grammar

Chmod [- cfvR] [--help] [--version] mode file...

Parameter description

Mode: permission setting string, in the following format:

[ugoa...] [[+-=] [rwxX]...] [,...]

Where:

U indicates the owner of the file, g indicates that the owner belongs to the same group (group) as the owner of the file, o indicates someone other than others, and an indicates all three.

+ means to increase permissions,-to cancel permissions, and = to set permissions uniquely.

R means readable, w means writable, x means executable, and X means only if the file is a subdirectory or if the file has been set to executable.

Description of other parameters:

-c: if the permission of the file has indeed been changed, the change action will be displayed.

-f: do not display an error message if the file permissions cannot be changed

-v: displays the details of permission changes

-R: make the same permission changes for all files and subdirectories in the current directory (that is, change them one by one recursively)

-- help: displays auxiliary instructions

-- version: display version

For example, add executable permissions to a shell file:

Chmod + x test3.sh

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

Chmod ugo+r file1.txt

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

Chmod Aguilr file1.txt

Set the file file1.txt and file2.txt as the owner of the file, which can be written by those who belong to the same group, but not by others:

Chmod ug+w,o-w file1.txt file2.txt

Add executable permissions to the owner of the ex1.py file:

Chmod uplix ex1.py has read this article, "how to modify read-only permissions in linux" article has been introduced, want to master the knowledge of this article still need to be hands-on practice in order to understand, if you want to know more related articles, welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report