In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains the "Linux system how to modify permissions and default permissions", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "Linux system how to modify permissions and default permissions" bar!
Linux system modify permissions and default permissions
The permissions of files and directories in the Linux system are introduced before. for the security of the operating system, a user's permissions on a file or directory are often modified in the actual production environment.
Modify permissions
The three members in the permissions column are in a group, representing the permissions of related users, groups, and other users, respectively.
Therefore, the permission to modify can be modified separately or together. The permissions in the system can be divided into numeric permissions and character permissions.
Digital permission: ringing 4thwelling 2jinxpen1
Character permissions: + add-remove a cancel all plus the given
Command chmod for modifying permissions
Chmod permissions file name or directory name modify permission format
U (user) represents owner, g (group) represents group, o (others) other users
Chmod-R permission directory name recursively modifies all permissions of the directory and all its contents below
Chown changes the owner (owner) of a file or directory
Chown user name file name or directory name
Chown user name. Group name file name or directory name
Chgrp can also be used to modify the group to which it belongs.
When you use ls-l to see that the owner and group of the file are numbers
Indicates that the user who created the file has been deleted
Special permissions for files
Chattr + I (- I) File name locked (unlocked) cannot be deleted and emptied
Chattr + a (- a) file name add content (only content can be added)
Special permissions to view files using lsattr filename
Default permissions
When we finish creating a directory or file, it will produce its own permissions, which is the default permissions of the system, so where does its default permissions come from? Let's introduce it.
From this it can be seen that
Root users create directory permissions of 755 and file permissions of 644 by default
The directory permission created by an ordinary user by default is 775, and the file permission is 664.
This is also the system's default relatively secure permission assignment.
In fact, these default permissions are all determined by the umask value.
The system stipulates
The permission value of the file is calculated from 666 (default permission = permission value-umask value)
The permission value of the directory is calculated from 777 (default permission = permission value-umask value)
Careful friends will find that the umask values here are all even numbers. What if they are changed to odd numbers? What's going to happen? Again, in the above picture (no picture, no truth), talking too much becomes nonsense.
So the problem is, the above formula algorithm is not correct, this is a special case.
When the umask value is odd, the default permission of the directory is unchanged, and the default permission of the file is that there is an odd value plus 1 in the calculated value to get the final permission value.
Permissions for file 1 = 444 (666-232, 434, color 43 (3, 1) 4)
Thank you for your reading, the above is the content of "how to modify permissions and default permissions in Linux system". After the study of this article, I believe you have a deeper understanding of how to modify permissions and default permissions in Linux system. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
Yum install-y sysstatsar-n DEV 1watch-n 1 "ifconfig enp0s8"
© 2024 shulou.com SLNews company. All rights reserved.