How to view file permissions
ls Command detailed
root user and file security control
What is root user
User Category
File Operation Permissions
character representation of file operation permissions
Chown
chgrp
use symbolic notation to set permissions on a file or directory
features of the chmod command
the-r option of the chmod command
What is notation notation
3 parts of a permission state
example of symbolic notation
set permissions on a file or directory using numeric notation
What is digital notation
the number represents the resource permission state
examples of digital representations
homework after class
"Content of this section"
1. How to view file permissions (see Linux System Management P138)
1) Master use the Ls–l command to view the permissions set on the file.
2) Master the ls–l command display results in the first column is divided into 4 groups, wherein;
a) The 1th character is the 1th group, which is either a file (-) or a directory (d), or another resource.
b) The 2nd, 3, 4 characters are Group 2nd, which defines the limited rights of the owner (owner) of the file or directory, and uses U to represent all the permissions of the owner (owner) on the file.
c) The 5th, 6, 7 characters are Group 3rd, which defines the permissions that other (users) have in the group where the owner of the file or directory resides, using G for this group permission.
d) 8th, 9, 10 characters are Group 4th, which defines the permissions that are not owner or other users of the same group as owner on the file or directory. Use o to represent this group (other) permission.
3) Master the owner and the group of the third and fourth column in the display result of the Ls–l command.
2.root User and file security control (see Linux System Management P136)
1) Master the definition of the root user: The root user, also known as the Superuser, has unrestricted access to any user's account and all files and directories.
2) Understand the classification of users in Linux systems:
The Linux system divides all users in the system into 3 categories:
a) class 1th: Owner
b) class 2nd: Same group of users (FIX: Owning group, because the process of creating a user will create a group with the same name as the user name)
C) Class 3rd: Other users not in the same group
3) The ability to master file operations includes reading (read), write, and Execute (execute)
4) Master the Linux operating system when displaying permissions, use the following 4 characters to indicate file operation permissions:
a) R: Represents the Read permission, which is the ability to read the file or the LS command to list the contents of the directory.
b) W: Represents the Write permission, which is the right to edit the file or create and delete files in a directory.
c) x: Represents execute permissions, that is, the ability to execute a program or switch to this directory with the CD command, and to use the LS command with the-l option to list the permissions for the details in this directory.
d)-: indicates no corresponding permission (corresponds to R, W, or X at the location).
3. Master of modifying files using Chown
Chown: Genus Group File
Chown: Genus Group File
Chown Master File
A) For example, the command that modifies the file file1 is root: chown root file1
4. Mastering the genus Group that uses CHGRP to modify files
CHGRP Group File
A) For example, the command to modify the genus of the file File1 for WG is: CHGRP WG file1
5. Use the notation method to set permissions on a file or directory (see Linux System Management P132)
1) Master the function of the chmod command: Set or change permissions on the file or directory.
2) Master-r option: not only set (or change) the directory permissions, but also recursively set (or) Change permissions for all files or subdirectories in that directory.
3) Mastery is the definition of symbolic notation:
symbolic notation is the use of several specific symbols to set the state of a permission.
4) The state of authority can be divided into 3 parts:
a) The 1th section, which indicates whose permission state to set or change. The specific expressions are as follows:
u: Represents the owner's permission.
g: Represents the permissions of the group.
o: Represents a permission that is neither owner nor other user (other) with owner in the same group.
A: Represents the permissions of the above 3 groups, that is, all users (all).
b) The 2nd part, is the operator (operator), also known as the operator, wherein the specific expression is as follows:
+: Indicates permission to join
-: Means remove permissions
=: Indicates set permissions
c) Part 3rd, indicating the authority (permission), in which the specific expression is as follows:
r: Indicates read (read) permission.
W: Indicates write permission.
X: Represents the Execut (execute) permission.
5) Flexibly apply symbolic notation to set or change permissions on a file or directory:
a) For example: Add the command for the owner and the same group of users to execute permissions on the Dog_wolf file:
chmod ug+x Dog_wolf
b) For example: The command to add write permissions to other users on the Babydog directory:
chmod o+w Babydog
6. Use digital notation to set permissions on a file or directory (see Linux System Management P143)
1) Master the definition of digital notation:
numeric notation refers to the use of a set of three-digit numbers to represent the state of permissions on a file or directory. Among them:
the 1th number represents the owner's permission (U).
the 2nd number represents the permissions of the group (g).
the 3rd number represents the Permissions (o) for other users (other).
2) The number represents the resource permission state:
4: Indicates a read permission.
2: Represents a Write permission.
1: Indicates that there is execute (EXECUTE) permission.
0: Indicates that there is no corresponding permission.
3) Flexible application of digital notation to set or change permissions on a file or directory:
a) For example: use digital notation to open the/home/dog/babydog directory and all of the permissions for all files in the owner, but to open read and execute permissions to the same group of users, and to open only read permissions to other users of the command:
chmod-r 754/home/dog/babydog
7. After-school assignments (spents 60 minutes)
1) Create a directory test in the user's home directory, enter test to create an empty file File1
[Email protected] ~]# cd/home/nulige/
[Email protected] nulige]# mkdir test
[Email protected] nulige]# CD test/
[email protected] test]# touch file1.
2) display file information in long format, note the permissions of the file and the user and group to which it belongs
[Email protected] test]# ls-l file1
-rw-r--r--1 root root 0 November 23:23 file1
3) Set permissions for file File1 so that other users can write to this file.
[Email protected] test]# chmod o+w file1
[Email protected] test]# ls-l file1
-rw-r--rw-1 root root 0 November 23:23 file1
#切换用户
[Email protected] ~]# Su-huzhihua
[Email protected] ~]$ cd/home/nulige/test/
[email protected] test]$ LL
Total Dosage 4
-rw-r--rw-1 root root 5 November 23:33 file1
#写点内容到文件中
[Email protected] test]$ echo 1111 >file1
4) View the setting results,
[email protected] test]$ cat File1
1111
5) Remove the Read permission from the same group of users to the file File1 and view the setting results.
[Email protected] test]# ls-l file1
-rw-r--rw-1 root root 5 November 23:33 file1
[Email protected] test]# chmod g-r file1
[Email protected] test]# ls-l file1
-RW----rw-1 root root 5 November 23:33 file1
6) Use digital notation to set permissions for file files, all readable, writable, and executable, and the owning group user and other users have only read and execute permissions. Review the setup results when the settings are complete.
[Email protected] test]# chmod 755 file1
[Email protected] test]# ls-l file1
-rwxr-xr-x 1 root root 5 November 23:33 file1
7) Change the permissions of the file File1 in digital form so that the owner can only read the file. No other user has permission. View the settings results.
[Email protected] test]# chmod file1
[Email protected] test]# ls-l file1
-R--------1 root root 5 November 23:33 file1
8) go back to the upper directory to see the test permissions
[Email protected] test]# CD.
[email protected] nulige]# LL
Total Dosage 8
Drwxr-xr-x 2 root root 4096 November 23:23 test
9) Add write permissions to this directory for other users
[Email protected] nulige]# chmod o+w test
[email protected] nulige]# LL
Total Dosage 8
Drwxr-xrwx 2 root root 4096 November 23:23 test
#切换其它用户, and write the file test
[Email protected] ~]# Su-huzhihua
[Email protected] ~]$ cd/home/nulige/test/
[email protected] test]$ Touch test01.txt
[email protected] test]$ LL
Total Dosage 4
-R--------1 root root 5 November 23:33 file1
-rw-rw-r--1 Huzhihua Huzhihua 0 November 00:02 test01.txt
Linux basics-in-depth discussion of user, group, and Permissions for unit seventh