How did Dongdong in/etc/passwd read it?
first, the inode information of each directory is listed:
root @ Ubuntu: /home/jack # ll-DI/etc/passwd
2 drwxr-XR-x 23 Root 4096 //
655364 drwxr-XR- X 132 Root 12288/etc/
665904-RW-r -- 1 Root 2201/etc/passwd
/etc/passwd as shown in the preceding figure, usually, the top inode number of a filesystem starts from 2.
1)/inode:
Find the inode in the root directory with the inode Number of/dev/hdc2 2 based on the mount point information, the inode standard permission allows us to read the content of the block (with R and X);
2)/block:
after the previous step, obtain the block number and find the inode number (1912545) with the ETC/directory in the block content.
3) inode of ETC/:
Read inode No. 1912545. It is found that vbird has the R and X permissions, so it can read the block content of ETC;
4) block of ETC/:
after the previous step, obtain the block number and find the I with the passwd file. Node number (1914888);
5) inode of passwd:
Read inode No. 1914888 and find that vbird has the r permission, therefore, you can read the content of the passwd block.
6) passwd block:
Finally, read the data of the block.