One, file or directory permissions chmod
rw-r--r--。
——— ——— ——— ——
Owner-owned group others are subject to selinux restrictions
R readable =4 w writable =2 x executable =1
chmod + number + file name modification permissions
All sub-files and subdirectories in the-R directory are batch modified permissions
650) this.width=650; "Src=" Https://s5.51cto.com/oss/201710/24/64f48c68321047aa09bb950ca2a24463.png-wh_500x0-wm_3 -wmp_4-s_406736029.png "title=" 1.png "alt=" 64f48c68321047aa09bb950ca2a24463.png-wh_ "/>
chmod + u/g/o + file name modification permissions
A = Ugo a-x all permissions minus Execute permission
650) this.width=650; "Src=" Https://s5.51cto.com/oss/201710/24/aa8c6437b8ec450bed3be10166e96e7c.png-wh_500x0-wm_3 -wmp_4-s_4029515507.png "title=" 2.png "alt=" Aa8c6437b8ec450bed3be10166e96e7c.png-wh_ "/>
There are two ways to remove the selinux limit.
1, temporarily close SELinux
650) this.width=650; "Src=" Https://s1.51cto.com/oss/201710/24/a678a58222db9cd5466e605f4f9f3ace.png-wh_500x0-wm_3 -wmp_4-s_2934268629.png "title=" 1.png "alt=" A678a58222db9cd5466e605f4f9f3ace.png-wh_ "/>
2, permanent, modify SELinux configuration file
650) this.width=650; "Src=" Https://s1.51cto.com/oss/201710/24/0080990022c4c0f5e0a3077f49eb0ec3.png-wh_500x0-wm_3 -wmp_4-s_1102166887.png "title=" 2.png "alt=" 0080990022c4c0f5e0a3077f49eb0ec3.png-wh_ "/>
Ii. Change owner and owning group Chown
Chown Change Owner
Chown + users: Group + files change users and owning groups at once
CHGRP Change group changes all groups
Chown-r Batch change owner or group of all files under directory
650) this.width=650; "Src=" Https://s1.51cto.com/oss/201710/24/d30f6b111cb10b14b10a020dd03af31b.png-wh_500x0-wm_3 -wmp_4-s_699640514.png "title=" 1.png "alt=" D30f6b111cb10b14b10a020dd03af31b.png-wh_ "/>
Third, Umask
Umask Determining default File directory permissions
Root umask Default Value 0022
The directory and the file are different. Directory must have X permissions, access to the directory is the execution directory, so there must be X permissions
So directory
777 Minus Umask
The file is made up of
666 minus Umask
650) this.width=650; "Src=" Https://s1.51cto.com/oss/201710/24/5c082ce1ab49d8a522c43ca6d8f03f0e.png-wh_500x0-wm_3 -wmp_4-s_2633056931.png "title=" 1.png "alt=" 5c082ce1ab49d8a522c43ca6d8f03f0e.png-wh_ "/>
Exception: When Umask is 003, the file directory is 664
666-003 = (rw-rw-rw-)-(-------wx) = rw-rw-r--= 664
777-003 = (rwxrwxrwx)-(---------wx) =rwxrwxr--= 774
650) this.width=650; "Src=" Https://s3.51cto.com/oss/201710/24/0df55abe397d78a83d2db03b1fa8da0c.png-wh_500x0-wm_3 -wmp_4-s_1723693862.png "title=" 1.png "alt=" 0df55abe397d78a83d2db03b1fa8da0c.png-wh_ "/>
Four, hidden permissions lsattr_chattr
Chattr change file attributes on a Linux file system
Chattr Set hidden Permissions command
+i changing files to read-only files, cannot be changed, cannot be deleted, cannot be renamed
For directories, cannot be deleted, cannot create new files, cannot be renamed, but cannot restrict writing of existing sub-file contents
-I cancel I permissions
(vi command to change a file, will save a cache file, such as Modify 1.txt, the 1.txt~ file will appear, when the Wq save exit, will overwrite the original file.
After you set the Hide permissions I, the file cannot be saved and a 1.txt~ cache file is automatically generated. )
650) this.width=650; "Src=" Https://s1.51cto.com/oss/201710/24/2bf2aad96a1c8988a1607c95fb593f0b.png-wh_500x0-wm_3 -wmp_4-s_115565175.png "title=" 1.png "alt=" 2bf2aad96a1c8988a1607c95fb593f0b.png-wh_ "/>
+a can only append to a file and change the time information (touch). Cannot be deleted, cannot be changed. cannot be renamed. such as logs,
You can add sub-files to a directory, or you can change the contents of a child file.
-A Cancel a permission
650) this.width=650; "Src=" Https://s1.51cto.com/oss/201710/24/6d7868a8257222ffa608074e48068f1d.png-wh_500x0-wm_3 -wmp_4-s_238046559.png "title=" 1.png "alt=" 6d7868a8257222ffa608074e48068f1d.png-wh_ "/>
Lsattr View hidden Permissions command to view the file itself or subdirectories and sub-files under the directory
-R view hidden permissions for files under directories and subdirectories
-A even hidden file hidden permissions also view
650) this.width=650; "Src=" Https://s3.51cto.com/oss/201710/24/ec3aaf4ee66a9921192a9b3827836a22.png-wh_500x0-wm_3 -wmp_4-s_4053934811.png "style=" Float:none; "title=" 1.png "alt=" Ec3aaf4ee66a9921192a9b3827836a22.png-wh_ "/>
650) this.width=650; "Src=" Https://s3.51cto.com/oss/201710/24/e0b4d3f5f10e707a201a7eb719b2767f.png-wh_500x0-wm_3 -wmp_4-s_739441507.png "style=" Float:none; "title=" 2.png "alt=" E0b4d3f5f10e707a201a7eb719b2767f.png-wh_ "/>
Linux Learning Notes (8)