]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/euidaccess.3
CPU_SET.3, INFINITY.3, __ppc_get_timebase.3, __ppc_set_ppr_med.3, __ppc_yield.3,...
[thirdparty/man-pages.git] / man3 / euidaccess.3
CommitLineData
c11b1abf 1.\" Copyright (C) 2007 Michael Kerrisk <mtk.manpages@gmail.com>
6ce8cde2 2.\"
93015253 3.\" %%%LICENSE_START(VERBATIM)
6ce8cde2
MK
4.\" Permission is granted to make and distribute verbatim copies of this
5.\" manual provided the copyright notice and this permission notice are
6.\" preserved on all copies.
7.\"
8.\" Permission is granted to copy and distribute modified versions of this
9.\" manual under the conditions for verbatim copying, provided that the
10.\" entire resulting derived work is distributed under the terms of a
11.\" permission notice identical to this one.
12.\"
13.\" Since the Linux kernel and libraries are constantly changing, this
14.\" manual page may be incorrect or out-of-date. The author(s) assume no
15.\" responsibility for errors or omissions, or for damages resulting from
16.\" the use of the information contained herein. The author(s) may not
17.\" have taken the same level of care in the production of this manual,
18.\" which is licensed free of charge, as they might when working
19.\" professionally.
20.\"
21.\" Formatted or processed versions of this manual, if unaccompanied by
22.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 23.\" %%%LICENSE_END
6ce8cde2 24.\"
fe0fefbf 25.TH EUIDACCESS 3 2015-03-02 "" "Linux Programmer's Manual"
6ce8cde2
MK
26.SH NAME
27euidaccess, eaccess \- check effective user's permissions for a file
28.SH SYNOPSIS
29.nf
86b91fdf 30.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
6ce8cde2 31.B #include <unistd.h>
68e4db0a 32.PP
6ce8cde2
MK
33.BI "int euidaccess(const char *" pathname ", int " mode );
34.BI "int eaccess(const char *" pathname ", int " mode );
35.fi
36.SH DESCRIPTION
37Like
fb186734 38.BR access (2),
6ce8cde2
MK
39.BR euidaccess ()
40checks permissions and existence of the file identified by its argument
41.IR pathname .
988db661 42However, whereas
23ac3223 43.BR access (2)
6ce8cde2
MK
44performs checks using the real user and group identifiers of the process,
45.BR euidaccess ()
46uses the effective identifiers.
847e0d88 47.PP
6ce8cde2
MK
48.I mode
49is a mask consisting of one or more of
a797afac 50.BR R_OK ", " W_OK ", " X_OK ", and " F_OK ,
988db661 51with the same meanings as for
fb186734 52.BR access (2).
847e0d88 53.PP
6ce8cde2
MK
54.BR eaccess ()
55is a synonym for
56.BR euidaccess (),
57provided for compatibility with some other systems.
47297adb 58.SH RETURN VALUE
6ce8cde2
MK
59On success (all requested permissions granted), zero is returned.
60On error (at least one bit in
61.I mode
62asked for a permission that is denied, or some other error occurred),
63\-1 is returned, and
64.I errno
65is set appropriately.
66.SH ERRORS
67As for
fb186734 68.BR access (2).
3b0ac71f
MK
69.SH VERSIONS
70The
71.BR eaccess ()
72function was added to glibc in version 2.4.
94a133a4 73.SH ATTRIBUTES
ef5bbec5
MK
74For an explanation of the terms used in this section, see
75.BR attributes (7).
76.TS
77allbox;
78lbw23 lb lb
79l l l.
80Interface Attribute Value
81T{
82.BR euidaccess (),
94a133a4 83.BR eaccess ()
ef5bbec5
MK
84T} Thread safety MT-Safe
85.TE
47297adb 86.SH CONFORMING TO
c8f2dd47 87These functions are nonstandard.
6ce8cde2
MK
88Some other systems have an
89.\" e.g., FreeBSD 6.1.
90.BR eaccess ()
91function.
d8f2cf30
MK
92.SH NOTES
93.IR Warning :
94Using this function to check a process's permissions on a file before
95performing some operation based on that information leads to race conditions:
96the file permissions may change between the two steps.
97Generally, it is safer just to attempt the desired operation and handle
98any permission error that occurs.
847e0d88 99.PP
8d81c0c9
MK
100This function always dereferences symbolic links.
101If you need to check the permissions on a symbolic link, use
6fdbc779 102.BR faccessat (2)
8d81c0c9
MK
103with the flags
104.BR AT_EACCESS
105and
106.BR AT_SYMLINK_NOFOLLOW .
47297adb 107.SH SEE ALSO
6ce8cde2 108.BR access (2),
6ce8cde2
MK
109.BR chmod (2),
110.BR chown (2),
6ce8cde2
MK
111.BR faccessat (2),
112.BR open (2),
6ce8cde2
MK
113.BR setgid (2),
114.BR setuid (2),
ad7cc990 115.BR stat (2),
53a1443c 116.BR credentials (7),
ad7cc990 117.BR path_resolution (7)