Linux common commands chmod to modify file permissions 777 and 754

Linux common commands chmod to modify file permissions 777 and 754

The following command is often used:

chmod 777 文件或目錄

Example: chmod 777 /etc/squid After running the command, the permissions of the squid folder (directory) are changed to 777 (readable, writable, and executable).

If it is Ubuntu system, you may need to add sudo to execute:

sudo chmod 777 /etc/squid

At the beginning of the story, there will always be a suspense.

In the series of jokes that only programmers can understand, there is a classic one:

Please describe our country's FL in the most concise language.

754.

So, what does 754 mean? What does 754 mean? What does 754 mean?

The following is a detailed introduction to the chmod command.

In the Linux system, the roles and permissions of each user are divided very carefully and strictly. Each file (directory) has access permission. This mechanism is used to determine whether a user can read, write, execute, and perform other operations on the file (directory) in a certain way.

There are three different types of users who operate files or directories: file owners, group users, and other users. The highest bit represents the permission value of the file owner, the middle bit represents the permission value of the group user, and the lowest bit represents the permission value of other users. Therefore, in chmod 777, the three numbers 7 correspond to the above three users, and the permission values ​​are all 7.

There are three types of file or directory permissions: read-only, write-only, and executable.

Permissions Permission Value Binary Specific role
r 4 00000100 read, read. The current user can read the contents of the file and browse the directory.
w 2 00000010 write, write. The current user can add or modify file contents, and the current user can delete or move directories or files within directories.
x 1 00000001 execute, execute. The current user can execute files and enter directories.

According to the table above, the permission combination is the sum of the corresponding permission values, as follows:

7 = 4 + 2 + 1 Read, write and execute permissions
5 = 4 + 1 Read and execute permissions

4 = 4 read-only permission

Therefore, everyone understands the meaning of the chmod 754 filename command.

This command means to grant the read, write and run permissions of the filename file to the file owner, grant the read and run permissions to the group users, and grant the read permission to other users.

For more official and detailed explanations, you can use the following command to view:

chmod --help or man chmod

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Detailed analysis of the chmod command to modify file permissions under Linux
  • Modify file permissions (ownership) under Linux
  • Linux server programming utime() function to modify file access time
  • How to modify the user and group of a file in Linux

<<:  How to connect to MySQL visualization tool Navicat

>>:  Vue implements tab label (label exceeds automatic scrolling)

Recommend

Have you really learned MySQL connection query?

1. Inner Join Query Overview Inner join is a very...

Analyzing the troublesome Aborted warning in MySQL through case studies

This article mainly introduces the relevant conte...

The new version of Chrome browser settings allows cross-domain implementation

Preface Currently, the front-end solves cross-dom...

Detailed example of clearing tablespace fragmentation in MySQL

Detailed example of clearing tablespace fragmenta...

Problems encountered in the execution order of AND and OR in SQL statements

question I encountered a problem when writing dat...

Detailed steps for debugging VUE projects in IDEA

To debug js code, you need to write debugger in t...

select the best presets to create full compatibility with all browsersselect

We know that the properties of the select tag in e...

Centos7 installation of FFmpeg audio/video tool simple document

ffmpeg is a very powerful audio and video process...

Vue's vue.$set() method source code case detailed explanation

In the process of using Vue to develop projects, ...

Vue integrates Tencent TIM instant messaging

This article mainly introduces how to integrate T...

Web lesson plans, lesson plans for beginners

Teaching Topics Web page Applicable grade Second ...

Solution to Element-ui upload file upload restriction

question Adding the type of uploaded file in acce...

Detailed steps for installing Tomcat, MySQL and Redis with Docker

Table of contents Install Tomcat with Docker Use ...

Using radial gradient in CSS to achieve card effect

A few days ago, a colleague received a points mal...