access(3)

DESCRIPTION

Checks whether the effective credentials can use path with the requested F_OK, R_OK, W_OK, and X_OK bits. F_OK checks existence and mode zero performs that same existence check.

SYNOPSIS

#include <unistd.h>

int access(const char *path, int mode);

RETURN VALUE

  • Returns zero when every requested check succeeds, or -1 and sets errno.

ERRORS

  • -EACCES
    • A requested read, write, or execute permission bit is absent.
  • -EFAULT
    • Path is null or cannot be read.
  • -EINVAL
    • Mode contains a bit other than F_OK, R_OK, W_OK, or X_OK.
  • -ENOENT
    • The path does not name an object.

NOTES

Owner bits are selected for the effective UID, group bits for the effective GID, and otherwise other bits. Supplementary groups are not consulted by this libc implementation. Effective UID zero bypasses read and write checks but still requires some execute bit for X_OK.