In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "linux modify file permissions chmod command is what", in daily operation, I believe many people in linux modify file permissions chmod command is what problem there is doubt, small make up consult all kinds of information, sort out simple and easy to use operation method, hope to answer everyone "linux modify file permissions chmod command is what" doubts help! Next, please follow the small series to learn together!
In Linux, who can do what to a file or directory is controlled by a set of permissions.
Permission controls what is done to a file or directory (read, write or execute).
We can list file permissions for files and directories using the-l (long format) option.
ls -l
In each row, the first character identifies the type of entry listed. If it is a dash ( -), then it is a file. If it's the letter d, it's the catalog.
The next nine characters represent three sets of permission settings.
The first three characters indicate the permissions of the user who owns the file (user rights).
The middle three characters show the privileges of a user group member (group privileges).
The last three characters show permissions for anyone other than the first two categories (other permissions).
There are three characters in each set of permissions. The character is an indicator of the presence or absence of permissions. They are dashes ( -) or letters. If the character is a dash, permission is not granted. If the character is an r, w, or x, the permission has been granted.
Letters stand for:
R: Read permissions. You can open a file and view its contents.
W: Write permission. The file can be edited, modified and deleted.
x: Executive authority. If the file is a script or program, it can be run (executed).
For example:
---means that no authority has been granted at all.
rwx indicates that full permissions have been granted. Read, write, and execute indicators are present.
Syntax for setting permissions
To set permissions using chmod, we need to tell it:
Who: For whom do we set permissions?
What: What changes are we making? Do we add or remove permissions?
Which: What permissions do we have?
We use metrics to represent these values and form short "permission statements," such as u+x, where "u" means "current user"(who),"+" means "add"(what), and "x" means "execute"(which).
The "who" values we can use are:
u: User, indicating the owner of the file.
g: Group, indicating the members of the group to which the file belongs.
o : Other, meaning someone who is not governed by u and g privileges.
A : All means all of the above.
The "what" values we can use include:
- : Minus sign. Remove permissions.
+: plus sign. Grant permission. The permission is added to existing permissions. If you want to have this permission and only set this permission, use the = option, as described below.
= : equals sign. Set permissions and remove other permissions.
The "which" values we can use are:
R: Read permissions.
W: Write permission.
x: Executive authority.
Examples:
We can add execute permissions for everyone using the following command:
chmod a+x new_script.sh
We want dave to have read and write permissions, while groups and other users have read permissions only. We can use the following command:
chmod u=rw,og=r new_file.txt
Using the "=" operator means that we clear all existing permissions and then set the specified permissions.
At this point, about "linux modify file permissions chmod command is what" the study is over, I hope to solve everyone's doubts. Theory and practice can better match to help you learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!
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
© 2024 shulou.com SLNews company. All rights reserved.