Get the App
SLTechnology News&Howtos  ›  Servers  › 

What does linux x permission mean?

Shulou Source: shulou.com Published: 2022-05-31 10:45:19 09月18日 Update

This article mainly introduces "what linux x permission refers to". In daily operation, I believe that many people have doubts about what linux x permission refers to. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "what does linux x authority refer to?" Next, please follow the editor to study!

In linux, x means "execute" permission. X permissions on files and directories have different effects: 1, for files, means that the file can be run, especially shell script files, no impact on ordinary files; 2, for directories, on behalf of the user can enter the specified directory, the user who gives x permission can use the cd command to switch directories.

The operating environment of this tutorial: CentOS 6 system, Dell G3 computer.

X refers to the execute permission.

In Linux systems, there are three most common file permissions, namely, read (r), write (w), and execute (x, for executable files or directories).

X (execute) permissions have different effects on files and directories:

Effect on documents

Execute permission (x) indicates that the file has permissions to be executed by the system. Whether a file is executable in Window system is checked by extension (.exe, .bat, etc.), but in Linux system, whether a file can be executed is determined by whether the file has x permission. That is, as long as the file has x permission, the file is an executable. However, whether the file can run correctly depends on whether the code in the file is correct.

Execution permissions are mainly used for shell script files and have no effect on normal files.

Effect on catalogue

The execute permission (x) directory cannot be run directly, and the directory is given x permission, which means that the user can enter the directory, that is, the user or group that gives x permission can use the cd command.

Note: for a directory, this directory cannot be used if only r permission is given. Quite simply, for a directory with only r permissions, users can only view the directory structure and cannot enter the directory at all (you need x permission), let alone use it.

Description:

1. Read-only access to the directory is not allowed to enter the directory using cd. You must have the permission to execute before you can enter the directory.

2. Only the execution permission can only enter the directory and cannot see the contents of the directory. If you want to see the file name and directory name under the directory, you need readable permission.

3. Whether a file can be deleted mainly depends on whether the directory in which the file is located has write permission to the user. If the directory does not have write permission to the user, then all files in the directory cannot be deleted, except the file owner.

4. The w permission of the directory is not set, even if you have the w permission of a file in the directory, you cannot write the file.

The following is a detailed description:

1. File directory

For a file directory, the x permission is the permission to enter the directory

In the figure above, after creating the test directory, you can check that its permission is drwxrwxr-x, and you have x permission for both the owner and the group, so you can enter the test directory.

Next, we slightly modify the group permissions to grant only 664 permissions, that is, neither the owner nor the group has the permission to operate. At this time, we try to enter the test directory Times permission problem.

2. Ordinary documents

At present, the executable permissions of ordinary files do not make much sense, because there is no x permission, which does not affect the reading and writing of files.

A test file, test.txt, is created here. You can see that the file does not have x permissions, but does not affect the read and write of the file.

3. Shell script file

For shell scripts, the script cannot be executed without x permission

It should be noted here that there are other methods for script execution, which can be executed without x permission, as follows

At this point, the study of "what does linux x authority refer to" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Tags: Permissions files directories users scripts systems ordinary functions learning influence running and then that is representatives only commands methods more questions. Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info MySQL Redmi Shulou Information NVidia