xref: /original-bsd/usr.sbin/chown/chown.8 (revision b185aca5)
1.\" Copyright (c) 1990, 1991 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)chown.8	6.7 (Berkeley) 05/28/92
7.\"
8.Dd
9.Dt CHOWN 8
10.Os BSD 4
11.Sh NAME
12.Nm chown
13.Nd change file owner and group
14.Sh SYNOPSIS
15.Nm chown
16.Op Fl Rf
17.Ar owner Op Ar :group
18.Ar file ...
19.Nm chown
20.Op Fl HRfh
21.Ar :group
22.Ar file ...
23.Sh DESCRIPTION
24.Nm Chown
25sets the user ID and/or the group ID of the specified files.
26.Pp
27The options are as follows:
28.Bl -tag -width Ds
29.It Fl H
30When encountering a symbolic link on the command line, follow it.  All other
31symbolic links encountered in the traversal are not followed.
32.It Fl R
33Change the user ID and/or the group ID for the file hierarchies rooted
34in the files instead of just the files themselves.
35.It Fl f
36Don't report any failure to change file owner or group, nor modify
37the exit status to reflect such failures.
38.It Fl h
39When encountering a symbolic link, change the ownership of the object the link
40points to rather than the link itself.
41.El
42.Pp
43With respect to symbolic links, unless the
44.Fl h
45or
46.Fl H
47flags are set,
48.Nm chown
49changes the ownership of the link itself rather than the object it
50points to.
51.Pp
52The
53.Ar owner
54and
55.Ar group
56operands are both optional, however, one must be specified.
57If the
58.Ar group
59operand is specified, it must be preceded by a colon (``:'') character.
60.Pp
61The
62.Ar owner
63may be either a numeric user ID or a user name.
64If a user name is also a numeric user ID, the operand is used as a
65user name.
66The
67.Ar group
68may be either a numeric group ID or a group name.
69If a group name is also a numeric group ID, the operand is used as a
70group name.
71.Pp
72The ownership of a file may only be altered by a super-user for
73obvious security reasons.
74.Pp
75The owner and group of symbolic links are themselves changed instead
76of the file to which the link points.
77.Pp
78The
79.Nm chown
80utility exits 0 on success, and >0 if an error occurs.
81.Sh COMPATIBILITY
82Previous versions of the
83.Nm chown
84utility used the dot (``.'') character to distinguish the group name.
85This has been changed to be a colon (``:'') character so that user and
86group names may contain the dot character.
87.Sh SEE ALSO
88.Xr chgrp 1 ,
89.Xr find 1 ,
90.Xr chown 2 ,
91.Xr fts 3
92.Sh STANDARDS
93The
94.Nm chown
95command is expected to be POSIX 1003.2 compliant.
96