access

#include <unistd.h>

Function Prototype

int access(const char *pathname, int mode);
  • mode - what kind of access to check
    • R_OK, W_OK, X_OK: check rwx
    • F_OK: check if file exists

Function

  • check the permission for “real” UID/GID
  • If return
    • 0 : have permission
    • -1 : no permission