How to change the permissions of a read-only file for a Linux system

Source: Internet
Author: User
Tags readable file permissions

Vim Editor can be entered in command mode: wq! Save Exit
You can modify file permissions with the chmod command.
The chmod command is very important for changing the access rights of a file or directory. Users use it to control access to files or directories. There are two ways to use this command. One is a text-setting method that contains letters and operator expressions, and the other is a digital setting method that contains numbers.
Usage:
Text Setting Method:
chmod [who] [+ | - | =] [mode] filename ¼
The meanings of the options in the command are:
Action object who is either or a combination of the following letters:
U means to tease the user, that is, the owner of the file or directory.
G means to tease the same group of users, that is, all users with the same group ID as the owner of the file.
O means to tease other (others) users.
A means to tease all (all) users. It is the system default value.
The operation symbols can be:
+ Add a permission.
-Cancels a permission.
= gives the given permission and cancels all other permissions, if any.
Setting the permissions represented by mode can be any combination of the following letters:
R is readable.
W writable.
X executable.
x append the x attribute only if the destination file is executable to some users, or if the target file is a directory.
S is the owner of the file in which the owner or group ID of the process is placed when the file is executed. The way tease U+s to set the user ID bit of the file, tease G+s to set the group ID bit.
T save the program's text to the swap device.
You have the same permissions as the owner of the file.
G has the same permissions as a user with the same group as the file owner.
o have the same permissions as other users.
File name: A list of files separated by spaces to change permissions, and wildcard characters are supported.
Multiple permission methods can be given in one command line, separated by commas. For example: chmod g+r,o+r example enables the same group and other users to have read access to the file example.
Digital Setting Method:
The meaning of the attribute represented by the number:
0 means no permissions
1 indicates executable permissions
2 indicates writable permissions
4 for readable permissions
and add them. So the format of the numeric attribute should be 3 octal numbers from 0 to 7, in the Order of (U) (g) (O)
4 (readable) +2 (writable) =6 (read/write) If you want to have two permissions for the owner of a file to amuse/write


For example, add executable permissions to a shell file:

chmod +x test3.sh



How to change the permissions of a read-only file for a Linux system

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.