1EUIDACCESS(3) Linux Programmer's Manual EUIDACCESS(3)
2
3
4
6 euidaccess, eaccess - check effective user's permissions for a file
7
9 #define _GNU_SOURCE /* See feature_test_macros(7) */
10 #include <unistd.h>
11
12 int euidaccess(const char *pathname, int mode);
13 int eaccess(const char *pathname, int mode);
14
16 Like access(2), euidaccess() checks permissions and existence of the
17 file identified by its argument pathname. However, whereas access(2)
18 performs checks using the real user and group identifiers of the
19 process, euidaccess() uses the effective identifiers.
20
21 mode is a mask consisting of one or more of R_OK, W_OK, X_OK, and F_OK,
22 with the same meanings as for access(2).
23
24 eaccess() is a synonym for euidaccess(), provided for compatibility
25 with some other systems.
26
28 On success (all requested permissions granted), zero is returned. On
29 error (at least one bit in mode asked for a permission that is denied,
30 or some other error occurred), -1 is returned, and errno is set appro‐
31 priately.
32
34 As for access(2).
35
37 The eaccess() function was added to glibc in version 2.4.
38
40 For an explanation of the terms used in this section, see
41 attributes(7).
42
43 ┌────────────────────────┬───────────────┬─────────┐
44 │Interface │ Attribute │ Value │
45 ├────────────────────────┼───────────────┼─────────┤
46 │euidaccess(), eaccess() │ Thread safety │ MT-Safe │
47 └────────────────────────┴───────────────┴─────────┘
49 These functions are nonstandard. Some other systems have an eaccess()
50 function.
51
53 Warning: Using this function to check a process's permissions on a file
54 before performing some operation based on that information leads to
55 race conditions: the file permissions may change between the two steps.
56 Generally, it is safer just to attempt the desired operation and handle
57 any permission error that occurs.
58
59 This function always dereferences symbolic links. If you need to check
60 the permissions on a symbolic link, use faccessat(2) with the flags
61 AT_EACCESS and AT_SYMLINK_NOFOLLOW.
62
64 access(2), chmod(2), chown(2), faccessat(2), open(2), setgid(2),
65 setuid(2), stat(2), credentials(7), path_resolution(7)
66
68 This page is part of release 5.04 of the Linux man-pages project. A
69 description of the project, information about reporting bugs, and the
70 latest version of this page, can be found at
71 https://www.kernel.org/doc/man-pages/.
72
73
74
75 2017-09-15 EUIDACCESS(3)