chown(S) 6 January 1993 chown(S) Name chown - change owner and group of a file Syntax cc . . . -lc #include <sys/types.h> int chown (path, owner, group) char *path; uid_t owner; gid_t 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. If the process has chown kernel authorization, only processes with effec- tive user ID equal to the file owner or super user may change the owner- ship of a file. Otherwise, only the super user may change the ownership of a file. chown kernel authorization is set by a system administrator using the sysadmsh(ADM)) utility. 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. chown fails and the owner and group of the named file remains unchanged if one or more of the following is true: [EACCES] Search permission is denied on a component of the path prefix. [EFAULT] path points outside the allocated address space of the process. [EINTR] A signal was caught during the chown system call. [EMULTIHOP] Components of path require hopping to multiple remote ma- chines. [ENOENT] The named file does not exist. [ENOLINK] path points to a remote machine and the link to that ma- chine is no longer active. [ENOTDIR] A component of the path prefix is not a directory. [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. Diagnostics Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error. See also chmod(S), chown(C) Standards conformance chown is conformant with: AT&T SVID Issue 2; X/Open Portability Guide, Issue 3, 1989; IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1); and NIST FIPS 151-1.