The
access() function checks the accessibility of the file named by
path for the access permissions indicated by
mode. The value of
mode is the bitwise inclusive OR of the access permissions to be checked (
R_OK for read permission,
W_OK for write permission and
X_OK for execute/search permission) or the existence test,
F_OK. All components of the pathname
path are checked for access permissions (including
F_OK).
The real user ID is used in place of the effective user ID and the real group access list (including the real group ID) are used in place of the effective ID for verifying permission.
If a process has super-user privileges and indicates success for
R_OK or
W_OK, the file may not actually have read or write permission bits set. If a process has super-user privileges and indicates success for
X_OK, at least one of the user, group, or other execute bits is set. (However, the file may still not be executable. See
execve(2).)