1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
|
.\" Hey Emacs! This file is -*- nroff -*- source.
.\"
.\" This manpage is Copyright (C) 1992 Drew Eckhardt;
.\" 1993 Michael Haardt, Ian Jackson.
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" Modified Wed Jul 21 19:36:29 1993, Rik Faith (faith@cs.unc.edu)
.\" Modified 21 Aug 1994 by Michael Chastain (mec@shell.portal.com):
.\" Removed note about old kernel (pre-1.1.44) using wrong id on path.
.\" Modified 18 Mar 1996 by Martin Schulze (joey@infodrom.north.de):
.\" Stated more clearly how it behaves with symbolic links.
.\" Added correction due to Nick Duffek (nsd@bbc.com), aeb, 960426
.\" Modified Sat Sep 07 18:17:26 MET DST 1996 by Michael Haardt:
.\" Restrictions for NFS
.\" Modified by Joseph S. Myers <jsm28@cam.ac.uk>, 970909
.\" Modified Tue Jan 13 21:21:03 MET 1998 by Michael Haardt:
.\" Using access is often insecure
.\"
.\" Japanese Version Copyright (c) 1997-1998 HANATAKA Shinya
.\" all rights reserved.
.\" Translated Wed Dec 17 00:05:13 JST 1997
.\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\" Modified Mon May 11 14:47:31 JST 1998
.\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\"
.\"WORD: user 桼
.\"WORD: file system ե롦ƥ
.\"WORD: object ֥
.\"WORD: symbolic link ܥå
.\"WORD: refer Ȥ
.\"WORD: mask ޥ
.\"WORD: path ѥ
.\"WORD: effective user-ID ¸桼ID
.\"WORD: real user-ID ¥桼ID
.\"WORD: uid 桼ID
.\"WORD: gid 롼ID
.\"WORD: directory ǥ쥯ȥ
.\"WORD: call
.\"WORD: kernel ͥ
.\"WORD: memory
.\"WORD: dangling symbolic link 줿ܥå
.\"
.TH ACCESS 2 "January 13, 1998" "Linux" "System calls"
.SH ̾
access \- 桼ΥեФ븢å
.SH
.nf
.B #include <unistd.h>
.sp
.BI "int access(const char *" pathname ", int " mode );
.fi
.SH
.B access
.IR pathname
Ȥ̾ĥե(ޤ¾Υե롦ƥΥ֥)
Фƥץɤ߹ߡߤƤ뤫
ե뤬¸ߤƤ뤫ʤɤΥåԤʤ
.I pathname
ܥåʤФΥܥåλȤե
Ф븢롣
.I mode
.BR R_OK ", " W_OK ", " X_OK ", " F_OK
ΰİʾ夫鹽ޥǤ롣
.BR R_OK ", " W_OK ", " X_OK
Ϥ줾ե뤬¸ߤɤ߹ߵġߵġ¹ԵĤ
뤫å褦᤹롣
.B F_OK
ϥե뤬¸ߤ뤫ɤΤߤå褦᤹롣
.IR pathname
Ϳ줿եؤΥѥ˸ǥ쥯ȥεĤ˰¸Ƥ롣
ޤܥåˤäƻȤեؤΥǥ쥯ȥ
¸Ƥ롣
åϼºݤǻѤץμ¸(effective)ID Ǥʤ
.I (real)
桼ID
.I (real)
롼ID ǹԤʤ롣
set-UID ץǵư桼θ¤ꤹ뤳Ȥ
ưפˤ롣
ӥåȤΤߤå졢եμƤϥåʤ
ǡǥ쥯ȥֽ꤬߲ǽפȤʤäϡ֤ǥ쥯ȥ
ե뤳ȤǽʤȤ̣ǥ쥯ȥեȤ
ळȤǽʤ櫓ǤϤʤƱͤ DOS Υեϡּ¹Բǽפ
ȽǤ뤬
.BR execve (2)
ϼԤ
.SH ֤
(Ƥᤵ줿Ĥ줿)֤롣
顼ξ(ʤȤĤ
.I mode
ᤵ줿Ĥʤä䡢¾Υ顼)
\-1 ֤졢
.I errno
Ŭڤꤵ롣
.SH 顼
.TP
.B EACCES
ᤵ줿
Υե뼫Ȥǧ줿
.IR pathname
ؤΥǥ쥯ȥΤɤ줫˸(search permission)ʤä
.TP
.B EROFS
ɤ߹(read-only)Υե롦ƥФƽߵĤ
ᤷ
.TP
.B EFAULT
.I pathname
ǽʥɥ쥹֤γؤƤ롣
.TP
.B EINVAL
.I mode
ͤꤵ줿
.TP
.B ENAMETOOLONG
.I pathname
Ĺ롣
.TP
.B ENOENT
.I pathname
Υǥ쥯ȥʬǽ¸ߤʤ줿(dangling)
ܥåǤ롣
.TP
.B ENOTDIR
.I pathname
Υǥ쥯ȥʬºݤˤϡǥ쥯ȥǤʤ
.TP
.B ENOMEM
ͥ˽ʬʥ꤬ʤ
.TP
.B ELOOP
.IR pathname
褹ݤ륷ܥå¿롣
.TP
.B EIO
I/O 顼ȯ
.SH
.B access
ᤵ줿Τɤ줫˼ԤˤϡȤ¾Τɤ줫
ȤƤ⥨顼֤
.PP
.B access
ϥ桼ID ޥåԥѤ NFS ե롦ƥǤ˵ǽ
ʤ⤷ʤʤʤХ桼ID ΥޥåԥϥСǹԤ
츢Υå륯饤ȤˤϸʤǤ롣
.PP
Using
.B access
to check if a user is authorized to e.g. open a file before actually
doing so using
.BR open (2)
creates a security hole, because the user might exploit the short time
interval between checking and opening the file to manipulate it.
ºݤ
.BR open (2)
Ѥ˥եץ븢ǧ뤿
.B access
Ѥ뤳Ȥϥƥۡˤʤ롣ʤʤåƤ
ºݤ˥եΥץ֤ûֳ֤ѤǤ뤫顣
.SH
SVID, AT&T, POSIX, X/OPEN, BSD 4.3
.SH Ϣ
.BR stat (2),
.BR open (2),
.BR chmod (2),
.BR chown (2),
.BR setuid (2),
.BR setgid (2)
|