CHOWN(2) SysV CHOWN(2)
NAME
chown - change owner and group of a file
SYNOPSIS
int chown (path, owner, group)
char *path;
int owner, group;
DESCRIPTION
path points to a pathname naming a file. The owner ID and group ID of
the named file are set to the numeric values contained in owner and
group, respectively.
Only processes with effective user ID equal to the file owner or super-
user can change the ownership of a file.
If chown is invoked by other than the super-user, the set-user-ID and
set-group-ID bits of the file mode, 04000 and 02000 respectively, will be
cleared.
ERRORS
chown will fail and the owner and group of the named file will remain
unchanged if one or more of the following are true:
[ENOTDIR] A component of the path prefix is not a directory.
[ENOENT] The named file does not exist.
[EACCES] Search permission is denied on a component of the path
prefix.
[EPERM] The effective user ID does not match the owner of the file
and the effective user ID is not super-user.
[EROFS] The named file resides on a read-only file system.
[EFAULT] path points outside the allocated address space of the
process.
[EINTR] A signal was caught during the chown system call.
SEE ALSO
chown(1), chmod(2).
DIAGNOSTICS
A successful call returns 0. A failed call returns -1 and sets errno as
indicated under "Errors."
NOTES
Under other implementations, chown fails if any of the following are
true:
[ENOLINK] path points to a remote machine and the link to that
machine is no longer active.
[EMULTIHOP] Components of path require hopping to multiple remote
machines.