]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/euidaccess.3
pow.3: Minor tweak to BUGS
[thirdparty/man-pages.git] / man3 / euidaccess.3
1 .\" Copyright (C) 2007 Michael Kerrisk <mtk.manpages@gmail.com>
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
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.
23 .\" %%%LICENSE_END
24 .\"
25 .TH EUIDACCESS 3 2017-09-15 "" "Linux Programmer's Manual"
26 .SH NAME
27 euidaccess, eaccess \- check effective user's permissions for a file
28 .SH SYNOPSIS
29 .nf
30 .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
31 .B #include <unistd.h>
32 .PP
33 .BI "int euidaccess(const char *" pathname ", int " mode );
34 .BI "int eaccess(const char *" pathname ", int " mode );
35 .fi
36 .SH DESCRIPTION
37 Like
38 .BR access (2),
39 .BR euidaccess ()
40 checks permissions and existence of the file identified by its argument
41 .IR pathname .
42 However, whereas
43 .BR access (2)
44 performs checks using the real user and group identifiers of the process,
45 .BR euidaccess ()
46 uses the effective identifiers.
47 .PP
48 .I mode
49 is a mask consisting of one or more of
50 .BR R_OK ", " W_OK ", " X_OK ", and " F_OK ,
51 with the same meanings as for
52 .BR access (2).
53 .PP
54 .BR eaccess ()
55 is a synonym for
56 .BR euidaccess (),
57 provided for compatibility with some other systems.
58 .SH RETURN VALUE
59 On success (all requested permissions granted), zero is returned.
60 On error (at least one bit in
61 .I mode
62 asked for a permission that is denied, or some other error occurred),
63 \-1 is returned, and
64 .I errno
65 is set appropriately.
66 .SH ERRORS
67 As for
68 .BR access (2).
69 .SH VERSIONS
70 The
71 .BR eaccess ()
72 function was added to glibc in version 2.4.
73 .SH ATTRIBUTES
74 For an explanation of the terms used in this section, see
75 .BR attributes (7).
76 .TS
77 allbox;
78 lbw23 lb lb
79 l l l.
80 Interface Attribute Value
81 T{
82 .BR euidaccess (),
83 .BR eaccess ()
84 T} Thread safety MT-Safe
85 .TE
86 .SH CONFORMING TO
87 These functions are nonstandard.
88 Some other systems have an
89 .\" e.g., FreeBSD 6.1.
90 .BR eaccess ()
91 function.
92 .SH NOTES
93 .IR Warning :
94 Using this function to check a process's permissions on a file before
95 performing some operation based on that information leads to race conditions:
96 the file permissions may change between the two steps.
97 Generally, it is safer just to attempt the desired operation and handle
98 any permission error that occurs.
99 .PP
100 This function always dereferences symbolic links.
101 If you need to check the permissions on a symbolic link, use
102 .BR faccessat (2)
103 with the flags
104 .BR AT_EACCESS
105 and
106 .BR AT_SYMLINK_NOFOLLOW .
107 .SH SEE ALSO
108 .BR access (2),
109 .BR chmod (2),
110 .BR chown (2),
111 .BR faccessat (2),
112 .BR open (2),
113 .BR setgid (2),
114 .BR setuid (2),
115 .BR stat (2),
116 .BR credentials (7),
117 .BR path_resolution (7)