1euidaccess(3)              Library Functions Manual              euidaccess(3)
2
3
4

NAME

6       euidaccess, eaccess - check effective user's permissions for a file
7

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

12       #define _GNU_SOURCE             /* See feature_test_macros(7) */
13       #include <unistd.h>
14
15       int euidaccess(const char *pathname, int mode);
16       int eaccess(const char *pathname, int mode);
17

DESCRIPTION

19       Like  access(2),  euidaccess()  checks permissions and existence of the
20       file identified by its argument pathname.  However,  whereas  access(2)
21       performs  checks  using  the  real  user  and  group identifiers of the
22       process, euidaccess() uses the effective identifiers.
23
24       mode is a mask consisting of one or more of R_OK, W_OK, X_OK, and F_OK,
25       with the same meanings as for access(2).
26
27       eaccess()  is  a  synonym  for euidaccess(), provided for compatibility
28       with some other systems.
29

RETURN VALUE

31       On success (all requested permissions granted), zero is  returned.   On
32       error  (at least one bit in mode asked for a permission that is denied,
33       or some other error occurred), -1 is returned, and errno is set to  in‐
34       dicate the error.
35

ERRORS

37       As for access(2).
38

ATTRIBUTES

40       For  an  explanation  of  the  terms  used  in  this  section,  see at‐
41       tributes(7).
42
43       ┌────────────────────────────────────────────┬───────────────┬─────────┐
44Interface                                   Attribute     Value   
45       ├────────────────────────────────────────────┼───────────────┼─────────┤
46euidaccess(), eaccess()                     │ Thread safety │ MT-Safe │
47       └────────────────────────────────────────────┴───────────────┴─────────┘
48

VERSIONS

50       Some other systems have an eaccess() function.
51

STANDARDS

53       None.
54

HISTORY

56       eaccess()
57              glibc 2.4.
58

NOTES

60       Warning: Using this function to check a process's permissions on a file
61       before  performing  some  operation  based on that information leads to
62       race conditions: the file permissions may change between the two steps.
63       Generally, it is safer just to attempt the desired operation and handle
64       any permission error that occurs.
65
66       This function always dereferences symbolic links.  If you need to check
67       the  permissions  on  a  symbolic link, use faccessat(2) with the flags
68       AT_EACCESS and AT_SYMLINK_NOFOLLOW.
69

SEE ALSO

71       access(2), chmod(2), chown(2), faccessat(2), open(2), setgid(2),  setu‐
72       id(2), stat(2), credentials(7), path_resolution(7)
73
74
75
76Linux man-pages 6.04              2023-03-30                     euidaccess(3)
Impressum