CHMOD(2)

NAME
chmod, chown - change permissions, ownership of a file.

SYNOPSIS
#include <sys/types.h>
#include <unistd.h>
int chmod (const char *file_name, mode_t mode)
int chown (const char *file_name, uid_t owner, gid_t group)

DESCRIPTION
chmod() changes permissions on file_name to be those specified in mode. The effective uid must be either uid of the inode or 0.

chown() changes owner to owner and group to group, and is only executable by root.

0 is returned on success, a negative value on error.

ERRORS
-EACCESS is returned when a non super user attempts to chown() a file, or when chmod() is called and euid is neither uid of the inode nor 0.

-ENOENT is returned when the file does not exist.

FILES
linux/fs/open.c, /usr/include/linux/sys.h, /usr/include/unistd.h

BUGS
Only the super user is allowed to chown() a file.