It seems only current user's permission can be checked via access()
.
(Example: rwx
).
Generally many file managers 开发者_C百科(Nautilus, Dolphin, Thunar, PCManFM, emelFM2, etc...) display the permissions for all of three subjects (Example: rwxr-xr-x
) somehow.
How to check the permission for all of three subjects (user, group, other users)?
You're looking for stat
- man 2 stat
Take a look a the stat function. It returns a structure with the permissions.
man 2 stat
The structure is also called stat, and includes a protection field st_mode.
精彩评论