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

What are the linux permissions?

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

Share

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

This article mainly explains "what kinds of linux permissions are there". Friends who are interested may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what kinds of linux permissions are there?"

There are four kinds of linux permissions: 1, read permission, that is, the right to read the contents of the file; 2, write permission, that is, the right to write data to the file; 3, executable permission; 4, special permission.

The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.

There are three identities for accessing files / directories in linux:

U: the owner of the file

G: the group to which the file belongs

O: other users

There are four more permissions for each identity

R: read permission (read)

For a file, it is the permission to read its contents, and for a directory, the contents of the directory cannot be viewed (ls failed)

W: write permission (write)

Write permission: for files, you can write data to files, but for directories, you cannot delete files in directories.

X: executable permissions (execute)

Lines are not available for executable files (you can see that the colors have changed), and directories cannot be entered for directories (cd failed)

S: special permissions

The expression of Linux permission

When it comes to permissions, you have to say users under linux!

There are only two kinds of linux users: ordinary users and super users

Superuser: with all the permissions under this system, you can do whatever you want, without any restrictions.

Ordinary users: only have some permissions, and there is a limit to what they can do (but usually we can use sudo to do something that requires root permission, but we need the password of root)

Change permissions digitally

Chmod 755 test.sh

Convert 755 to rwxr-xr-x, which means that the file owner, group, and other users can read and run the test.sh file, but only the owner can write to the file, that is, no one else has the right to modify the test.sh file.

(of course, root users have no such restrictions, and they can change whoever they want. This is also an experience that embodies the supreme power of root accounts! )

Change file permissions in character form

Chmod + x test.sh

The mathematical form can change the four permissions of all three identities of the file at one time, while the character form is more flexible. A permission of an identity can be set separately. For example, the above instruction is to grant execution permissions to all three identities. You can also set it separately:

Chmod Ubunx test.sh only adds executable permissions to the owner chmod Groupx test.sh only adds executable permissions to group identities chmod oexecux test.sh only adds executable permissions to others identities

Taken together, the above three instructions are equivalent to the one above, which enables executable permissions for all identities. You can also do this as follows:

Chmod axix test.sh

The a here represents all three identities!

If you want to remove a permission from an identity, you only need to change + to -, for example, to remove the executable permission from the identity of others:

Chmod Omurx test.sh here, I believe you have a deeper understanding of "what kinds of linux permissions are there?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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