catalogs
1. shell commands and how they work
2.1 Classification of document visitors (persons)
2.2 File types and access rights (thing attributes)
2.3 Representation of file permission values
2.4 Methods for setting file access rights
4. Permissions for directories★
One must always pay for past laziness!
1. shell commands and how they work
(1) From a technical point of view. Shell The simplest definition of a command-line interpreter ( command Interpreter ) contains mainly:Translate user commands to the core ( kernel ) processing; at the same time, the core processing results are translated to the user.(2) The significance of the existence of the shell: the shell reduces the cost of operating the OS; protects the OS;
Our common command line interpreter (shell) for centos 7 is called bash.[shell is the generic term, bash is the specific one]
2. The concept of authority
![[linux] Permission Understanding [linux] Permission Understanding](https://imgs.developpile.com/imgs/b81587f2b98841fe9f9857964f4176f0.png)
(1) A password is required to go from regular user to regular user.(2) No password is required to go from Super User to Normal User. [Super user password is important]
Suggestion: It is recommended to set different passwords for root and normal users, and the password for super users must be complex.
3. Authority management
2.1 Classification of document visitors (persons)
In the linux system, people are divided into three categories: (1) the owner of the file (owner) (2) the group to which the file belongs (grouper)(3) Other users of the document (other)Linux There are two types of users under: super users ( root ), ordinary users. (root and regular users can be one of the above three categories)
2.2 File types and access rights (thing attributes)
File type: (files are not distinguished by file extension under linux)d : Folders (text, source code, executable programs, third-party static libraries, etc.) [Catalog Files– : General Documentationl : Soft links (similar to Windows (shortcut) [link to fileb : Block device files (e.g., hard disk, CD-ROM drive, etc.)p : Pipeline documentationc : Character device files (e.g. serial devices such as screens)s : Set of interface documents
gcc is a compiler software on linux. [Although linux does notDistinguish files by file suffix, but software in linux will】
b) basic authorityi. Read ( r/4 ): Read For a file, permission to read the contents of the file; for a directory, permission to view information about the directoryii. Write ( w/2 ): Write Permission to modify the contents of a file for files, and to delete files in a directory for directories.iii. Implementation ( x/1 ): execute For files, permission to execute the file; for directories, permission to enter the directoryiv.“—”Indicates that you do not have this permission
Permissions are centered around user and file attributes (read, write, execute).
Permission operations on files: (1) Modify file attributes (2) Modify people
2.3 Representation of file permission values
b)8Numerical Representation of the Progressive Scale
2.4 Methods for setting file access rights
root is not restricted by normal user privileges.
Format of the chmod command permission value:① User Indicator +/-= privileged character+: Adds the privilege indicated by the privilege code to the scope of the privilege.-: Removes the privilege indicated by the privilege code from the privilege range.=: Assigns to the scope of authority the authority indicated by the authority designator.User Symbols:u : Ownerg : owner’s cohort witho : Other usersa : All usersExample:# chmod u+w /home/abc.txt# chmod o-x /home/abc.txtchmod a=x /home/abc.txt [all users only have the permission to execute this]
②Three 8 decimal fractionExample:# chmod 664 /home/abc.txt# chmod 640 /home/abc.txt
chown change owner file This will result in an error and should be written as (1)sudo chown Change of owner Documentation; [the role of sudo, elevate the privilege to execute the program as root] (2) first change the user to super user, and thenchown change owner file。
(1)sudo chgrp changedaffiliated groupfile[The role of sudo, elevate the privilege to execute the program as root] (2) First change the user to super user, and thenchgrp changedaffiliated groupfile。
(1)sudo chown Owners of change: revisedaffiliated groupfile(2) Change the user to a super user first, and thenchown Owners of change: revisedaffiliated groupfile。
(1) We create directories with permissions: 775; we create files with permissions: 664 (may vary from system to system)
Default directory permissions are: 777; default file permissions are: 666
(2) umark 0000; then we create directories with permission: 777; and files with permission: 666 [i.e., default permissions].
3. The file directive
file File/directory
4. Directory permissions★
executable privilege : If the directory does not have executable permissions , failing agreement cd to the catalog .Readable permissions. If the directory does not have readable permissions , then it is not possible to use the ls and other commands to view the directory’sList of documents .writable authority : If the directory has no writable permissions , Then you can’t create a file in the directory , It is also not possible to delete files in the directory
5. Sticky bits★
When one has write access to a directory, one can create and delete files. But everyone with write access to a directory can delete any file in the directory. If we don’t want people to delete our own files, we can add sticky bits to the directory.
6. Summary of authority
(4)So in the catalog, even though it is possible to executelscommand, but still does not have permission to read the documents in the directory.