Iii. linux File System permissions and hardware and software links involved

Source: Internet
Author: User

Iii. linux File System permissions and hardware and software links 2. Any device in linux is a file when the linux kernel is loaded. Files include files in windows, directories in windows, and devices in windows. 1. Significance of file permissions r: You can read the specific content of this file; w: You can edit the content of this file, including adding and deleting the specific content of the file, but not deleting the file; x: The file has the executable permission ------- note: this is different from window. In win, the executable permission of the file is expressed through the extension, such as exe and bat, however, in linux, the executable permission of a file is determined by x, which has nothing to do with the file name. The rwx permission is for the file content. Because there is no file name in the inode and block of the file, these permissions have nothing to do with the deletion of file names. 2. Meaning of directory permissions r: you can view the complete file list in this directory. When you have the r permission, you can read the file names of all files in the directory -?????????????? Testd ?????????????? Test1d ?????????????? Test2d ?????????????? Test3 w: You can change all files and directories in this directory as follows: You can create new files or directories in this directory; you can delete an existing file or directory in this directory (regardless of the permission of the file, please pay special attention to this !!!!) You can rename and change the location of a file or directory. X: the directory does not have the executable permission. Therefore, the function of x in the directory allows other users to access this directory. If you want to create a read-only file, you must ensure that the permission for the file is 4. The permission for the folder where the file is located is r_x. Because there is no x, the file cannot be read from the file, with w, you can delete the file and format the disk. After formatting, the file system has planned the inode and block. The inode and block will not change unless the disk size or format is changed. When creating a directory in linux, ext2 will allocate an inode and at least one block to the directory. The inode records the related permissions and attributes of the Directory and the block numbers assigned to the directory. When the block records the file name in the Directory and the inode occupied by the file name to create a new file, ext2 will first find the directory where the file is located, allocate an inode and the block required by the file size to the file, and record the file name and inode occupied by the file name in the block of the directory. Inode records the attributes of the file (excluding the file name) and the number of the block in which the file is actually stored (level 3). The preceding description shows that 1. When a file is read, you must first read the inode of the Directory and find the block occupied by the Directory to find the inode where the file is located, and then find the actual file based on the inode's three-level index. 2. The file name is only related to the directory where the file is located, and the file attributes are related to the inode of the file. Different file names can point to the same inode. This is called hard link (the meaning of the connection field is how many different file names are connected to this inode) A soft connection establishes a connection to the corresponding file name. When the file name is deleted, the entire path will fail. A public inode number is used to hard link the original file and the linked file. They are the same file, while soft link the original file and the linked file have different inode numbers. They are two different files; the soft link on the file property clearly indicates that it is a link file. Creating a soft link is to create a new file. When you access a linked file, the system will find that it is a linked file. It reads the linked file and finds the file to be accessed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.