1. The results of the execution using the LS-L command are as follows (/var/log):
Drwxr-x---2 root adm 4096 2013-08-07 11:03 apache2
Drwxr-xr-x 2 root root 4096 2013-08-07 09:43 AppArmor
Drwxr-xr-x 2 root root 4096 2013-08-07 09:44 apt
-rw-r-----1 syslog adm 16802 2013-08-07 14:30 Auth.log
-rw-r--r--1 root root 642 2013-08-07 11:03 Boot.log
Drwxr-xr-x 2 root root 4096 2013-08-06 18:34 Consolekit
Drwxr-xr-x 2 root root 4096 2013-08-07 09:44 Cups
-rw-r-----1 syslog adm 10824 2013-08-07 11:08 Daemon.log
Drwxr-xr-x 2 root root 4096 2013-08-07 09:45 Dbconfig-common
-rw-r-----1 syslog adm 21582 2013-08-07 11:03 Debug
Drwxr-xr-x 2 root root 4096 2013-08-07 09:45 Dist-upgrade
-rw-r--r--1 root adm 59891 2013-08-07 11:03 DMESG
The display results are broadly divided into seven columns (partial):
Take the first record as an example
copy content to clipboardCode:
第一列 : “drwxr-x---” 表识文件的类型 和文件权限
第二列: “2”是纯数字 ,表示 文件链接个数
第三列 : “root” 表示文件的所有者
第四列:“adm” 表示为文件的所在群组
第五列:“4096”,表示为文件长度(大小)
第六列:“2013-08-07 11:03”,表示文件最后更新(修改)时间
第七列:“apache2” 表示文件的名称
See:
2. File type and file permissions, which is the first column of the list: (Take the first record as an example)
"Drwxr-x---" meaning: There are two parts, part of the first column is "D", the file type (directory or folder), the other part is "rwxr-x---" means the file permissions, the permissions are divided into three paragraphs: that is, "rwx", "r-x" and "---" respectively, the text The permissions of the owner of the file, the rights of the group to which it belongs, and other user permissions on the file.
(1) file types, broadly divided into the following categories:
D: Catalogue
-: File
L: Link
S:socket
P:named Pipe
B:block Device
C:character Device
(2) file permissions:
R: Meaning "readable", denoted by the number 4
W: meaning "writable" is represented by the number 2
X (small X): meaning "executable" is represented by the number 1
-: meaning "no permission" is represented by the number 0
X (large X): The x attribute is appended only if the destination file is executable to some users, or if the target file is a directory.
S: A file in which the owner or group ID of a process is placed at the time of execution of the file. The way "U+s" sets the user ID bit of the file, "G+s" sets the group ID bit.
T: Meaning to save the program's text to the swap device
3. Changes to file permissions:
Use command: chmod file permissions file name [-R]
Two uses of the command:
(1) Directly assign the appropriate permissions to the file is:
chmod a+x Auth.log #含义为 giving the owner executable permission to the Auth.log file
2) Use digital instead of permissions:
For example:
chmod 777 Auth.log #含义为给auth. log file gives any readable, writable, executable permission
See the following list for the meanings of numbers:
Owner |
Group |
Other |
Number of three-bit delegate permissions |
R W X |
R W X |
R W X |
Actual results |
4 2 1 |
4 2 1 |
4 2 1 |
777 |
4 2 1 |
4 0 1 |
4 0 1 |
705 |
4. Changes to the file owner:
Command chown The user name file, for example:
chmod MySQL auth.log #含义为 Change the owner of the file Auth.log to MySQL
5. Changes to the group where the files are located
Command CHGRP [-r] Group name file name
For example:
Chgrp-r MySQL apache2 #含义为, change the directory apache2 group to MySQL
-
20130807144329984.jpeg
(9.09 KB)
-
2014-1-26 10:41
-
20130807144329984.jpeg
(9.09 KB)
-
2014-1-26 10:43
Linux "ls-l" file list permissions detailed "Go"