开发者

How to check the permission for group and other users?

开发者 https://www.devze.com 2023-02-22 17:42 出处:网络
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 permi

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消