COHERENT manpages

This page displays the COHERENT manpage for chown() [Change ownership of a file].

List of available manpages
Index


chown() -- System Call (libc)

Change ownership of a file
#include <unistd.h>
chown(file, uid, gid)
char *file; short uid, gid;

chown() changes the owner of file to user id uid and group id gid.

To change  only the user  id without changing  the group id,  use stat() to
determine the value of gid to pass to chown().

chown() is restricted to  the superuser, because granting the ordinary user
the ability  to change the  ownership of files might  circumvent file space
quotas or accounting based upon file ownership.

chown() returns -1  for errors, such as nonexistent file  or the caller not
being the superuser.

See Also

chmod(),
libc,
passwd,
stat(),
unistd.h
POSIX Standard, §5.6.5