All rights reserved. The Berkeley software License Agreement
specifies the terms and conditions for redistribution.
@(#)chown.2 6.2 (Berkeley) 05/22/85
chown(path, owner, group) char *path; int owner, group;fchown(fd, owner, group) int fd, owner, group;
On some systems, chown clears the set-user-id and set-group-id bits on the file to prevent accidental creation of set-user-id and set-group-id programs owned by the super-user.
Fchown is particularly useful when used in conjunction with the file locking primitives (see flock (2)).
Only one of the owner and group id's may be set by specifying the other as -1.
15 [ENOTDIR] A component of the path prefix is not a directory.
15 [EINVAL] The pathname contains a character with the high-order bit set.
15 [ENAMETOOLONG] A component of a pathname exceeded 255 characters, or an entire path name exceeded 1023 characters.
15 [ENOENT] The named file does not exist.
15 [EACCES] Search permission is denied for a component of the path prefix.
15 [ELOOP] Too many symbolic links were encountered in translating the pathname.
15 [EPERM] The effective user ID does not match the owner of the file and the effective user ID is not the super-user.
15 [EROFS] The named file resides on a read-only file system.
15 [EFAULT] Path points outside the process's allocated address space.
Fchown will fail if:
15 [EBADF] Fd does not refer to a valid descriptor.
15 [EINVAL] Fd refers to a socket, not a file.
15 [EROFS] The named file resides on a read-only file system.