5frame
5frame

Reputation: 101

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 (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)?

Upvotes: 0

Views: 189

Answers (2)

Mr. Shickadance
Mr. Shickadance

Reputation: 5473

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.

Upvotes: 1

Erik
Erik

Reputation: 91270

You're looking for stat - man 2 stat

Upvotes: 2

Related Questions