Files
oldlinux-files/Minix/2.0.0/wwwman/man2/chown.2.html
2024-02-19 00:21:39 -05:00

124 lines
2.4 KiB
HTML

<HTML>
<HEAD>
<TITLE>chown(2)</TITLE>
</HEAD>
<BODY>
<H1>chown(2)</H1>
<HR>
<PRE>
</PRE>
<H2>NAME</H2><PRE>
chown - change owner and group of a file
</PRE>
<H2>SYNOPSIS</H2><PRE>
<STRONG>int</STRONG> <STRONG>chown(const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG><EM>path</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>owner</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>group</EM><STRONG>)</STRONG>
</PRE>
<H2>DESCRIPTION</H2><PRE>
The file that is named by <EM>path</EM> has its <EM>owner</EM> and <EM>group</EM> changed as
specified. Only the super-user may change the owner of the file, because
if users were able to give files away, they could defeat file-space
accounting procedures. The owner of the file may change the group to a
group of which he is a member.
On some systems, <EM>chown</EM> 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.
</PRE>
<H2>RETURN VALUE</H2><PRE>
Zero is returned if the operation was successful; -1 is returned if an
error occurs, with a more specific error code being placed in the global
variable <STRONG>errno</STRONG>.
</PRE>
<H2>ERRORS</H2><PRE>
<STRONG>Chown</STRONG> will fail and the file will be unchanged if:
[ENOTDIR] A component of the path prefix is not a directory.
[ENAMETOOLONG] The path name exceeds PATH_MAX characters.
[ENOENT] The named file does not exist.
[EACCES] Search permission is denied for a component of the path
prefix.
[ELOOP] Too many symbolic links were encountered in translating
the pathname. (Minix-vmd)
[EPERM] The effective user ID is not the super-user.
[EROFS] The named file resides on a read-only file system.
[EFAULT] <EM>Path</EM> points outside the process's allocated address space.
[EIO] An I/O error occurred while reading from or writing to the
file system.
</PRE>
<H2>SEE ALSO</H2><PRE>
<STRONG><A HREF="../man8/chown.8.html">chown(8)</A></STRONG>, <STRONG><A HREF="../man1/chgrp.1.html">chgrp(1)</A></STRONG>, <STRONG><A HREF="../man2/chmod.2.html">chmod(2)</A></STRONG>.
</PRE>
</BODY>
</HTML>