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 Linux file permissions?

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

Share

Shulou(Shulou.com)06/02 Report--

This article is to share with you about what the permissions of Linux files are. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.

Linux file permissions

Before delving into it, let's take a look at the basic information about file permissions. [recommended: Linux video tutorial]

First create a file of information

> $touch new_file > $ll new_file > $- rw-r--r-- 1 root root 0 April 23 22:59 new_file

The file new_file has the following three sets of permissions:

Rw-: the owner of the file, and the login user's permission rw is to read and write respectively.

Rmurf -: the permission of the group to which the file owner belongs

R Murray: the permission of other users to read r

Of course, there is also an x executable permission that is not available here, and can be added through the chmod command. We'll talk about this later. Let's first talk about the origin of file permissions and how the default permissions after the touch command come from. To know, the first thing to know is the existence of umask. You can get the default value through the umask command. This value is very useful.

> $umask > $0022 / / this is the value on my machine.

To understand how this umask works, first understand the security settings for octal mode. The security settings in octal mode first get the values of these three rwx permissions, and then convert them to three-digit binary values, represented by an octal value. In this binary representation, each position represents a binary bit. For example, if the only read permission rmusic-converted to binary is 100, then the representative octal is 4.

As shown in the following table:

Once you know the corresponding permissions and octal values, take a look at the above new_file that has permissions of 644. So it's a little confusing here, how did this value come from? What's the point of 0022 of umask? In fact, this value is just a mask.

He will block permissions unlike those granted to that level of security. For a file, the full permission is 666. the value minus umask is the permission for the newly created file. 644 is exactly what we expected, and the w permissions of the group to which the file belongs and other users are blocked by default. It is stated here that the full permission of the folder is 777. If you want to block more permissions, you can change the value of umask.

> $umask 026 Thank you for your reading! About what the Linux file permissions are shared here, I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.

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