Home System Tutorial LINUX An in-depth interpretation of the plus sign and dot in the permission column in Linux

An in-depth interpretation of the plus sign and dot in the permission column in Linux

Jul 02, 2024 pm 04:51 PM
linux linux tutorial Red Hat linux system linux command linux certification red hat linux linux video

An in-depth interpretation of the plus sign and dot in the permission column in Linux

1. Summary

In Linux, the ls -l command is the most commonly used. The first column in the command display result is also where we are more concerned. Generally speaking, the characters indicating permissions occupy 10 positions. However, we often see content displayed at the eleventh position in this column. The most common one is the dot (.), and the plus sign (+) will also appear in this position. What is this? What's going on? Let's try it out with our own hands, shall we?

2. Regarding the dot (.) in the permission column

2.1 Let’s take a look at the root directory.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

[root@DCGH ~]# ls -lZ /

lrwxrwxrwx. root root system_u:object_r:bin_t:s0 bin -> usr/bin

dr-xr-xr-x. root root system_u:object_r:boot_t:s0 boot

drwxr-xr-x. root root system_u:object_r:device_t:s0 dev

drwxr-xr-x. root root system_u:object_r:etc_t:s0 etc

drwxr-xr-x. root root system_u:object_r:home_root_t:s0 home

lrwxrwxrwx. root root system_u:object_r:lib_t:s0 lib -> usr/lib

lrwxrwxrwx. root root system_u:object_r:lib_t:s0 lib64 -> usr/lib64

drwxr-xr-x. root root system_u:object_r:mnt_t:s0 media

drwxr-xr-x. root root system_u:object_r:mnt_t:s0 mnt

drwxr-xr-x. root root system_u:object_r:usr_t:s0 opt

dr-xr-xr-x. root root system_u:object_r:proc_t:s0 proc

dr-xr-x---. root root system_u:object_r:admin_home_t:s0 root

drwxr-xr-x. root root system_u:object_r:var_run_t:s0 run

lrwxrwxrwx. root root system_u:object_r:bin_t:s0 sbin -> usr/sbin

drwxr-xr-x. root root system_u:object_r:var_t:s0 srv

dr-xr-xr-x. root root system_u:object_r:sysfs_t:s0 sys

drwxrwxrwt. root root system_u:object_r:tmp_t:s0 tmp

drwxr-xr-x. root root system_u:object_r:usr_t:s0 usr

drwxr-xr-x. root root system_u:object_r:var_t:s0 var

Copy after login

2.2 Create a file and a directory in the HOME directory respectively, and observe the details of the eleventh position of the permissions.

1

2

3

4

5

6

[root@DCGH ~]# touch DCGH

[root@DCGH ~]# mkdir DCGH-DIR

[root@DCGH ~]# ls -l

总用量 0

-rw-r--r--. 1 root root 0 3月 28 10:23 DCGH

drwxr-xr-x. 2 root root 6 3月 28 10:24 DCGH-DIR

Copy after login

2.3 Check the SELinux status of this machine and list the basic information about SELinux in the files and directories in this directory.

1

2

3

4

5

[root@DCGH ~]# getenforce

Enforcing

[root@DCGH ~]# ls -lZ

-rw-r--r--. root root unconfined_u:object_r:admin_home_t:s0 DCGH

drwxr-xr-x. root root unconfined_u:object_r:admin_home_t:s0 DCGH-DIR

Copy after login

2.4 Close SELinux, create experimental files and directories again, and list the basic information about SELinux in this directory and the files and directories under the root again.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

[root@DCGH ~]# sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config

[root@DCGH ~]# reboot

[root@DCGH ~]# getenforce

Disabled

[root@DCGH ~]# ls -lZ

-rw-r--r--. root root unconfined_u:object_r:admin_home_t:s0 DCGH

drwxr-xr-x. root root unconfined_u:object_r:admin_home_t:s0 DCGH-DIR

[root@DCGH ~]# touch DCGH-later

[root@DCGH ~]# mkdir DCGH-later-dir

[root@DCGH ~]# ls -lZ

-rw-r--r--. root root unconfined_u:object_r:admin_home_t:s0 DCGH

drwxr-xr-x. root root unconfined_u:object_r:admin_home_t:s0 DCGH-DIR

-rw-r--r-- root root ? DCGH-later

drwxr-xr-x root root ? DCGH-later-dir

[root@DCGH ~]# ls -lZ /

lrwxrwxrwx. root root system_u:object_r:bin_t:s0 bin -> usr/bin

dr-xr-xr-x. root root system_u:object_r:boot_t:s0 boot

drwxr-xr-x root root ? dev

drwxr-xr-x. root root system_u:object_r:etc_t:s0 etc

drwxr-xr-x. root root system_u:object_r:home_root_t:s0 home

lrwxrwxrwx. root root system_u:object_r:lib_t:s0 lib -> usr/lib

lrwxrwxrwx. root root system_u:object_r:lib_t:s0 lib64 -> usr/lib64

drwxr-xr-x. root root system_u:object_r:mnt_t:s0 media

drwxr-xr-x. root root system_u:object_r:mnt_t:s0 mnt

drwxr-xr-x. root root system_u:object_r:usr_t:s0 opt

dr-xr-xr-x root root ? proc

dr-xr-x---. root root system_u:object_r:admin_home_t:s0 root

drwxr-xr-x root root ? run

lrwxrwxrwx. root root system_u:object_r:bin_t:s0 sbin -> usr/sbin

drwxr-xr-x. root root system_u:object_r:var_t:s0 srv

dr-xr-xr-x root root ? sys

drwxrwxrwt. root root system_u:object_r:tmp_t:s0 tmp

drwxr-xr-x. root root system_u:object_r:usr_t:s0 usr

drwxr-xr-x. root root system_u:object_r:var_t:s0 var

Copy after login

Through the above example, we can see that this point (.) is not useless, but it has a huge effect, and we usually don’t pay much attention to it. Files and directories created after SELinux is turned on will show this dot in the permission column. Files and directories created after SELinux is turned off will not show this dot in the permission column. Files or directories created before will remain unchanged.

3. Regarding the plus sign (+) in the permission column

3.1 Friends who have learned about ACL permission settings in Linux must be familiar with this plus sign. But let us verify it through experiments.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

[root@DCGH ~]# setfacl -m u:dcgh:rwx *

 

[root@DCGH ~]# ls -lZ

 

-rw-rwxr--+ root root unconfined_u:object_r:admin_home_t:s0 DCGH

 

drwxrwxr-x+ root root unconfined_u:object_r:admin_home_t:s0 DCGH-DIR

 

drwxrwxr-x+ root root ? DCGH-DIR-later -rw-rwxr--+ root root ? DCGH-later

 

[root@DCGH ~]# setfacl -b *

 

[root@DCGH ~]# ls -lZ

 

-rw-r--r--. root root unconfined_u:object_r:admin_home_t:s0 DCGH

 

drwxr-xr-x. root root unconfined_u:object_r:admin_home_t:s0 DCGH-DIR

 

drwxr-xr-x root root ? DCGH-DIR-later -rw-r--r-- root root ? DCGH-later

Copy after login

We can see that after adding ACL permission control, the last position of the permission column of files and directories that previously had SELinux attributes has changed to a plus sign (+). After removing the original ACL permissions, restore them to their original state.

4. Summary

4.1 The dots in the Linux permission column are not meaningless characters. Directories and files created when SELinux is turned on have this point. This point in the permissions column indicates that the directory or file has SELinux-related permissions set. After disabling SELinux permissions, it is inconvenient for files or directories created when SELinux permissions were previously enabled to retain their original permissions, and the dots in the permissions column are still displayed. Newly created directories or files do not have this dot displayed in the permissions column.

4.2 If the last position in the permission column is a plus sign, it means that this directory or file has already set ACL permission related content. If the plus sign exists, the display of dots for directories or files that already have dots will be overwritten, but the original SELinux attributes remain unchanged.

The above is the detailed content of An in-depth interpretation of the plus sign and dot in the permission column in Linux. For more information, please follow other related articles on the PHP Chinese website!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1668
14
PHP Tutorial
1273
29
C# Tutorial
1256
24
Linux Architecture: Unveiling the 5 Basic Components Linux Architecture: Unveiling the 5 Basic Components Apr 20, 2025 am 12:04 AM

The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.

How to check the warehouse address of git How to check the warehouse address of git Apr 17, 2025 pm 01:54 PM

To view the Git repository address, perform the following steps: 1. Open the command line and navigate to the repository directory; 2. Run the "git remote -v" command; 3. View the repository name in the output and its corresponding address.

How to run java code in notepad How to run java code in notepad Apr 16, 2025 pm 07:39 PM

Although Notepad cannot run Java code directly, it can be achieved by using other tools: using the command line compiler (javac) to generate a bytecode file (filename.class). Use the Java interpreter (java) to interpret bytecode, execute the code, and output the result.

How to run sublime after writing the code How to run sublime after writing the code Apr 16, 2025 am 08:51 AM

There are six ways to run code in Sublime: through hotkeys, menus, build systems, command lines, set default build systems, and custom build commands, and run individual files/projects by right-clicking on projects/files. The build system availability depends on the installation of Sublime Text.

What is the main purpose of Linux? What is the main purpose of Linux? Apr 16, 2025 am 12:19 AM

The main uses of Linux include: 1. Server operating system, 2. Embedded system, 3. Desktop operating system, 4. Development and testing environment. Linux excels in these areas, providing stability, security and efficient development tools.

laravel installation code laravel installation code Apr 18, 2025 pm 12:30 PM

To install Laravel, follow these steps in sequence: Install Composer (for macOS/Linux and Windows) Install Laravel Installer Create a new project Start Service Access Application (URL: http://127.0.0.1:8000) Set up the database connection (if required)

git software installation git software installation Apr 17, 2025 am 11:57 AM

Installing Git software includes the following steps: Download the installation package and run the installation package to verify the installation configuration Git installation Git Bash (Windows only)

How to use sublime shortcut keys How to use sublime shortcut keys Apr 16, 2025 am 08:57 AM

Sublime Text provides shortcuts to improve development efficiency, including commonly used (save, copy, cut, etc.), editing (indentation, formatting, etc.), navigation (project panel, file browsing, etc.), and finding and replacing shortcuts. Proficiency in using these shortcut keys can significantly improve Sublime's efficiency.

See all articles