1ACCESS(2) System Calls Manual ACCESS(2)
2
3
4
6 access - determine accessibility of file
7
9 access(name, mode)
10 char *name;
11
13 Access checks the given file name for accessibility according to mode,
14 which is 4 (read), 2 (write) or 1 (execute) or a combination thereof.
15 Specifying mode 0 tests whether the directories leading to the file can
16 be searched and the file exists.
17
18 An appropriate error indication is returned if name cannot be found or
19 if any of the desired access modes would not be granted. On disallowed
20 accesses -1 is returned and the error code is in errno. 0 is returned
21 from successful tests.
22
23 The user and group IDs with respect to which permission is checked are
24 the real UID and GID of the process, so this call is useful to set-UID
25 programs.
26
27 Notice that it is only access bits that are checked. A directory may
28 be announced as writable by access, but an attempt to open it for writ‐
29 ing will fail (although files may be created there); a file may look
30 executable, but exec will fail unless it is in proper format.
31
33 stat(2)
34
36 (access = 33.)
37 sys access; name; mode
38
39
40
41 ACCESS(2)