The file access tests that the kernel performs each time a process opens, creates, or deletes a file depend on the owners of the file (st_uidand st_gid), the effective IDs of the process (effective user ID and effective group ID), and the supplementary group IDs of the process, if supported. The two owner IDs are properties of the file, whereas the two effective IDs and the supplementary group IDs are properties of the process. The tests performed by the kernel are as follows.
-
If the effective user ID of the process is 0 (the superuser), access is allowed. This gives the superuser free rein throughout the entire file system.
-
If the effective user ID of the process equals the owner ID of the file (i.e., the process owns the file), access is allowed if the appropriate user access permission bit is set. Otherwise, permission is denied. By appropriate access permission bit, we mean that if the process is opening the file for reading, the user-read bit must be on. If the process is opening the file for writing, the user-write bit must be on. If the process is executing the file, the user-execute bit must be on.
-
If the effective group ID of the process or one of the supplementary group IDs of the process equals the group ID of the file, access is allowed if the appropriate group access permission bit is set. Otherwise, permission is denied.
-
If the appropriate other access permission bit is set, access is allowed. Otherwise, permission is denied.
本文详细介绍了操作系统内核如何根据文件所有者、进程的有效用户ID和组ID以及补充组ID来确定文件访问权限。具体步骤包括超级用户直接授权、文件所有者的权限检查、所属组的权限检查以及其他用户的权限检查。
1450

被折叠的 条评论
为什么被折叠?



