开发者

How to check the permission for group and other users?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜