]>
Commit | Line | Data |
---|---|---|
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 | .\" |
4b8c67d9 | 25 | .TH EUIDACCESS 3 2017-09-15 "" "Linux Programmer's Manual" |
6ce8cde2 MK |
26 | .SH NAME |
27 | euidaccess, 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 | |
37 | Like | |
fb186734 | 38 | .BR access (2), |
6ce8cde2 MK |
39 | .BR euidaccess () |
40 | checks permissions and existence of the file identified by its argument | |
41 | .IR pathname . | |
988db661 | 42 | However, whereas |
23ac3223 | 43 | .BR access (2) |
6ce8cde2 MK |
44 | performs checks using the real user and group identifiers of the process, |
45 | .BR euidaccess () | |
46 | uses the effective identifiers. | |
847e0d88 | 47 | .PP |
6ce8cde2 MK |
48 | .I mode |
49 | is a mask consisting of one or more of | |
a797afac | 50 | .BR R_OK ", " W_OK ", " X_OK ", and " F_OK , |
988db661 | 51 | with the same meanings as for |
fb186734 | 52 | .BR access (2). |
847e0d88 | 53 | .PP |
6ce8cde2 MK |
54 | .BR eaccess () |
55 | is a synonym for | |
56 | .BR euidaccess (), | |
57 | provided for compatibility with some other systems. | |
47297adb | 58 | .SH RETURN VALUE |
6ce8cde2 MK |
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 | |
fb186734 | 68 | .BR access (2). |
3b0ac71f MK |
69 | .SH VERSIONS |
70 | The | |
71 | .BR eaccess () | |
72 | function was added to glibc in version 2.4. | |
94a133a4 | 73 | .SH ATTRIBUTES |
ef5bbec5 MK |
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 (), | |
94a133a4 | 83 | .BR eaccess () |
ef5bbec5 MK |
84 | T} Thread safety MT-Safe |
85 | .TE | |
47297adb | 86 | .SH CONFORMING TO |
c8f2dd47 | 87 | These functions are nonstandard. |
6ce8cde2 MK |
88 | Some other systems have an |
89 | .\" e.g., FreeBSD 6.1. | |
90 | .BR eaccess () | |
91 | function. | |
d8f2cf30 MK |
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. | |
847e0d88 | 99 | .PP |
8d81c0c9 MK |
100 | This function always dereferences symbolic links. |
101 | If you need to check the permissions on a symbolic link, use | |
6fdbc779 | 102 | .BR faccessat (2) |
8d81c0c9 MK |
103 | with the flags |
104 | .BR AT_EACCESS | |
105 | and | |
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) |