Manual Page Result
0
Command: chmod | Section: 2 | Source: UNIX v10 | File: chmod.2
CHMOD(2) System Calls Manual CHMOD(2)
NAME
chmod, fchmod, chown, fchown, utime - change file mode, owner, group,
or times
SYNOPSIS
int chmod(file, mode)
char *name;
int fchmod(fildes, mode)
int chown(file, uid, gid)
char *name;
int fchown(fildes, uid, gid)
#include <sys/types.h>
int utime(file, timep)
char *file;
time_t timep[2];
DESCRIPTION
These functions change inode information for the file named by a null-
terminated string or associated with file descriptor fildes.
Chmod and fchmod change file permissions and other mode bits to mode.
Mode values are defined in stat(2). Only the 07777 bits of mode are
significant. Only the owner of a file (or super-user) may change the
mode. Only a process in the file's group (or super-user) may set the
set-group-id bit, S_ISGID.
Chown and fchown change the owner, uid, and the group, gid, of a file.
Only the super-user may change a file's owner. The owner of a file may
change its group to match the current effective groupid. Other changes
are restricted to the super-user.
Utime sets the st_atime (access time) and st_mtime (modify time) fields
for file to timep[0] and timep[1] respectively. The st_ctime (inode
change time) field for file is set to the current time.
The caller must be the owner of the file or the super-user.
SEE ALSO
stat(2), time(2)
DIAGNOSTICS
all: EIO, EPERM
chmod, chown, utime: ELOOP, ENOENT, ENOTDIR, EACCES, EFAULT
fchmod, fchown: EBADF
BUGS
An attempt to change the inode data for a file on a read-only file sys-
tem is quietly ignored.
CHMOD(2)