Files
oldlinux-files/Linux-0.98/Yggdrasil-0.98.3/usr/man/man2/chmod.2
2024-02-19 00:21:16 -05:00

45 lines
942 B
Groff

.TH CHMOD 2
.UC 4
.SH NAME
chmod, chown \- change permissions, ownership of a file.
.SH SYNOPSIS
.nf
.B #include <sys/types.h>
.B #include <unistd.h>
.B "int chmod (const char *file_name, mode_t mode)"
.B "int chown (const char *file_name, uid_t owner, gid_t group)"
.fi
.SH DESCRIPTION
.B chmod()
changes permissions on
.I file_name
to be those specified in
.I mode.
The effective uid must be either uid of the inode or 0.
.PP
.B chown()
changes owner to
.I owner
and group to
.I group,
and is only executable by root.
.PP
0 is returned on success, a negative value on error.
.SH ERRORS
.B -EACCESS
is returned when a non super user attempts to
.B chown()
a file, or when
.B chmod()
is called and euid is neither uid of the inode nor 0.
.PP
.B -ENOENT
is returned when the file does not exist.
.SH FILES
linux/fs/open.c, /usr/include/linux/sys.h, /usr/include/unistd.h
.SH BUGS
Only the super user is allowed to
.B chown()
a file.