| 1 |
'\" t |
| 2 |
.\" Copyright 2007, Michael Kerrisk <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 6 |
.\" |
| 7 |
.TH euidaccess 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
euidaccess, eaccess \- check effective user's permissions for a file |
| 10 |
.SH LIBRARY |
| 11 |
Standard C library |
| 12 |
.RI ( libc ,\~ \-lc ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */" |
| 16 |
.B #include <unistd.h> |
| 17 |
.P |
| 18 |
.BI "int euidaccess(const char *" path ", int " mode ); |
| 19 |
.BI "int eaccess(const char *" path ", int " mode ); |
| 20 |
.fi |
| 21 |
.SH DESCRIPTION |
| 22 |
Like |
| 23 |
.BR access (2), |
| 24 |
.BR euidaccess () |
| 25 |
checks permissions and existence of the file identified by its argument |
| 26 |
.IR path . |
| 27 |
However, whereas |
| 28 |
.BR access (2) |
| 29 |
performs checks using the real user and group identifiers of the process, |
| 30 |
.BR euidaccess () |
| 31 |
uses the effective identifiers. |
| 32 |
.P |
| 33 |
.I mode |
| 34 |
is a mask consisting of one or more of |
| 35 |
.BR R_OK ", " W_OK ", " X_OK ", and " F_OK , |
| 36 |
with the same meanings as for |
| 37 |
.BR access (2). |
| 38 |
.P |
| 39 |
.BR eaccess () |
| 40 |
is a synonym for |
| 41 |
.BR euidaccess (), |
| 42 |
provided for compatibility with some other systems. |
| 43 |
.SH RETURN VALUE |
| 44 |
On success (all requested permissions granted), zero is returned. |
| 45 |
On error (at least one bit in |
| 46 |
.I mode |
| 47 |
asked for a permission that is denied, or some other error occurred), |
| 48 |
\-1 is returned, and |
| 49 |
.I errno |
| 50 |
is set to indicate the error. |
| 51 |
.SH ERRORS |
| 52 |
As for |
| 53 |
.BR access (2). |
| 54 |
.SH ATTRIBUTES |
| 55 |
For an explanation of the terms used in this section, see |
| 56 |
.BR attributes (7). |
| 57 |
.TS |
| 58 |
allbox; |
| 59 |
lbx lb lb |
| 60 |
l l l. |
| 61 |
Interface Attribute Value |
| 62 |
T{ |
| 63 |
.na |
| 64 |
.nh |
| 65 |
.BR euidaccess (), |
| 66 |
.BR eaccess () |
| 67 |
T} Thread safety MT-Safe |
| 68 |
.TE |
| 69 |
.SH VERSIONS |
| 70 |
Some other systems have an |
| 71 |
.\" e.g., FreeBSD 6.1. |
| 72 |
.BR eaccess () |
| 73 |
function. |
| 74 |
.SH STANDARDS |
| 75 |
None. |
| 76 |
.SH HISTORY |
| 77 |
.TP |
| 78 |
.BR eaccess () |
| 79 |
glibc 2.4. |
| 80 |
.SH NOTES |
| 81 |
.IR Warning : |
| 82 |
Using this function to check a process's permissions on a file before |
| 83 |
performing some operation based on that information leads to race conditions: |
| 84 |
the file permissions may change between the two steps. |
| 85 |
Generally, it is safer just to attempt the desired operation and handle |
| 86 |
any permission error that occurs. |
| 87 |
.P |
| 88 |
This function always dereferences symbolic links. |
| 89 |
If you need to check the permissions on a symbolic link, use |
| 90 |
.BR faccessat (2) |
| 91 |
with the flags |
| 92 |
.B AT_EACCESS |
| 93 |
and |
| 94 |
.BR AT_SYMLINK_NOFOLLOW . |
| 95 |
.SH SEE ALSO |
| 96 |
.BR access (2), |
| 97 |
.BR chmod (2), |
| 98 |
.BR chown (2), |
| 99 |
.BR faccessat (2), |
| 100 |
.BR open (2), |
| 101 |
.BR setgid (2), |
| 102 |
.BR setuid (2), |
| 103 |
.BR stat (2), |
| 104 |
.BR credentials (7), |
| 105 |
.BR path_resolution (7) |