1. Basic permissions for files (nine bytes, divided into three segments)
rw- r-- r--
Basic permissions are unrestricted for root.
1. For files, users fall into three categories
u: --user Owner of the document g: --group Groups of documents o: --other Someone else a: --all All rw- r-- r-- u g o |-------------| a
2. Classification of permissions
r:--read permission w:--write permission x:--Exceute Execution Permission - No permission
3. chmod - change mode to modify or set permissions for files
1) The most commonly used way of digital permission (*)
Numbers corresponding to permissions r -- 4 w -- 2 x -- 1 - -- 0 rw- r-- r-- : 644
[root@localhost ~]# ll aaa
-rw-r--r--. 1 root root 0 1month 8 17:00 aaa
[root@localhost ~]# chmod 777 aaa
[root@localhost ~]# ll aaa
-rwxrwxrwx. 1 root root 0 1month 8 17:00 aaa
2) Letter Representation
u g o a
(1) Equivalent permissions=
[root@localhost ~]# chmod o=r aaa
[root@localhost ~]# ll aaa
-rwxrwxr--. 1 root root 0 1month 8 17:00 aaa
(2) Value-added authority+
[root@localhost ~]# chmod 600 aaa
[root@localhost ~]# ll aaa
-rw-------. 1 root root 0 1month 8 17:00 aaa
[root@localhost ~]# chmod go+rw aaa
[root@localhost ~]# ll aaa
-rw-rw-rw-. 1 root root 0 1month 8 17:00 aaa
(3) Cancellation of authority-
[root@localhost ~]# chmod g-rw aaa
[root@localhost ~]# ll aaa
-rw----rw-. 1 root root 0 1month 8 17:00 aaa
View the user umask, modify the user umask, directly follow the umask number.
[root@localhost ~]# umask
0022
[root@localhost ~]# su - Loyal
[Loyal@localhost ~]$ umask
0002
Maximum permissions for directories 777 Maximum permissions for files 666 Default permissions for files: maximum permissions for files - umask Default permissions for directories: maximum permissions for directories - umask
4. Permissions of Files
r exists alone to view the contents of the file w exists independently and can not see the content of the file, but it can be forced to modify the content of the file, and it will cover the content of the original file. It is of little significance to exist independently. x exists alone. It's meaningless. Composite permissions for files rx permissions: files are readable, executable, and unmodifiable rw permissions: readable, writable, non-executable wx: unreadable, non-executable, overwriting
5. Permissions of Catalogues
For directories: When only r permission is available, it can read (report errors), write, and enter directories. It makes no sense to have only w permissions. Only x permission, can only enter, can not read, can not write Summary: Directory rw permission: you can view the content, not enter the directory, not delete the directory or the files in it rx permission of directory: you can view the contents, you can enter the directory, you can not modify the contents of the directory wx permission of directory: you can not view the contents of directory, you can enter the directory, you can delete the files in the directory, if you need to know what files are in the directory
II. File System
1. File system: A method of organizing files on disk, called a file system. File system is a system that manages and allocates storage space, is responsible for the storage of files and protects and retrieves the stored files. 2. File system structure MBR partition 1 partition 2 partition 3 ____________ block group 0 block group 1 ... (super block,group descriptors table, block bitmap,inode bitmap,inode table,block table) super block: super block, different file systems are different, recording the overall information of the file system, including the total inode/block, usage, residual and file system format, related information inode: Record file attributes (file size, permission, time, i node number, etc.), but not file names. A file occupies an i node, which records the block number of data. 3. File Storage Point to the data block on disk through the i node 4. Distinction of ext2, ext3, ext 4 ext2 is a non-log file system ext3 and ext4 are both log file systems ext3 supports a maximum of 16TB filesystems and a maximum of 32000 single files of 2TB. Subdirectory, inode size 128 bytes ext4 supports 1EB file system, 16TB single file, unlimited subdirectory inode size 256 bytes 5. File search process 6. View File System Information
#dumpe2fs -h /dev/sda1
Default mount options: user_xattr acl //Default mount option
Filesystem state: clean //Explain that there is no problem with the file system
Errors behavior: Continue //File System Operating System Types
Filesystem OS type: Linux
Inode count: 102400 //Number of i nodes
Block count: 409600 //Number of data blocks
Reserved block count: 20480 //Number of blocks reserved
Free blocks: 361729 //Number of free blocks
Free inodes: 102362 //Number of idle i nodes
First block: 1
Block size: 1024 //Block size (4KB)
......
Inode size: 128 //i node size (in bytes)
III. File System Detection
fsck - Command to Check and Fix Linux File System Errors e2fsck When will it be used? Usually it is only used as root and when there is a problem with the file system.
[root@localhost ~]# fsck /dev/sda1
fsck from util-linux-ng 2.17.2
e2fsck 1.41.12 (17-May-2010)
/dev/sda1 is mounted.
e2fsck: Unable to continue, Suspension.
Note: To detect the file system, you need to uninstall the detected device or partition before you can.
[root@localhost ~]# umount /dev/sda1
[root@localhost ~]# fsck /dev/sda1
fsck from util-linux-ng 2.17.2
e2fsck 1.41.12 (17-May-2010)
/dev/sda1: clean, 38/102400 files, 47871/409600 blocks
clean proves that partitioning is okay
- a: Automatically fix the problems encountered in the process of detection, and no interaction is required.
[root@localhost ~]# fsck -a /dev/sda1
fsck from util-linux-ng 2.17.2
/dev/sda1: clean, 38/102400 files, 47871/409600 blocks