The results of the execution using the LS-L command are as follows (/var/log):
[HTML]
- 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
Drwxr-x---2 root adm 4096 2013-08-07 11:03 apache2drwxr-xr-x 2 root root 4096 2013-08-07 09:43 Apparmordrwxr-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.logdrwxr-xr-x 2 root root 4096 2013-08-06 18:34 Consolekitdrwxr-xr-x 2 root root 4096 2013-08-07 09:44 cups-rw-r-----1 syslog adm 10824 2013-08-07 11:08 daemon.logdrwxr-xr-x 2 root root 4096 2013-08-07 09:45 dbconfig-common-rw-r-----1 syslog< C18/>adm 21582 2013-08-07 11:03 debugdrwxr-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
[HTML]
- First column: "Drwxr-x---" the type of document and file permissions
- Second column: "2" is a pure number, indicating the number of file links
- Third column: "Root" indicates the owner of the file
- Fourth column: "ADM" as the group where the files are located
- Fifth column: "4096", expressed as file length (size)
- Sixth column: "2013-08-07 11:03", indicating the last update (modification) time of the file
- Seventh column: "Apache2" indicates the name of the file
The first column: "Drwxr-x---" the type and file permissions of the file The second column: "2" is a pure number, indicating the number of file links in the third column: "Root" means the owner of the file fourth column: "ADM" is represented as the group Fifth column of the file: "4096", expressed as the file length ( Size) column sixth: "2013-08-07 11:03", indicating the last update (modified) time of the file Seventh column: "Apache2" indicates the name of the file
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:
[HTML]
- D: Catalogue
- -: File
- L: Link
- S:socket
- P:named Pipe
- B:block Device
- C:character Device
D: Directory-: File L: Link s:socket p:named pipe b:block device C : Character device
(2) file permissions:
[HTML]
- 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
R: Meaning "readable", denoted by the number 4 w: meaning "writable" with the number 2 means X (small x): meaning "executable" is represented by the number 1-: meaning "no permission" with the number 0 represents X (large X): meaning that only the target file is executable to some users or the target file is a directory plus the X attribute. S: A file in which the owner or group ID of a process is placed at the time of execution of the file. The user ID bit of the "u+s" setting 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:
[HTML]
- chmod a+x Auth.log #含义为 giving the owner executable permission to the Auth.log file
chmod a+x auth.log
(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 |
W x |
rwx |
rw x |
actual result |
2 |
421 |
42 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
Linux "ls-l" file list permissions detailed