xref: /original-bsd/usr.sbin/chown/chown.8 (revision e58c8952)
1.\" Copyright (c) 1990, 1991, 1993, 1994
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)chown.8	8.3 (Berkeley) 03/31/94
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.Oo
17.Fl R
18.Op Fl H | Fl L | Fl P
19.Oc
20.Op Fl f
21.Ar owner Op Ar :group
22.Ar file ...
23.Nm chown
24.Oo
25.Fl R
26.Op Fl H | Fl L | Fl P
27.Oc
28.Op Fl f
29.Ar :group
30.Ar file ...
31.Sh DESCRIPTION
32.Nm Chown
33sets the user ID and/or the group ID of the specified files.
34.Pp
35The options are as follows:
36.Bl -tag -width Ds
37.It Fl H
38If the
39.Fl R
40option is specified, symbolic links on the command line are followed.
41(Symbolic links encountered in the tree traversal are not followed.)
42.It Fl L
43If the
44.Fl R
45option is specified, all symbolic links are followed.
46.It Fl P
47If the
48.Fl R
49option is specified, no symbolic links are followed.
50.It Fl R
51Change the user ID and/or the group ID for the file hierarchies rooted
52in the files instead of just the files themselves.
53.It Fl f
54Don't report any failure to change file owner or group, nor modify
55the exit status to reflect such failures.
56.El
57.Pp
58Symbolic links don't have owners, so unless the
59.Fl H
60or
61.Fl L
62option is set,
63.Nm chown
64on a symbolic link always succeeds and has no effect.
65The
66.Fl H ,
67.Fl L
68and
69.Fl P
70options are ignored unless the
71.Fl R
72option is specified.
73In addition, these options override each other and the
74command's actions are determined by the last one specified.
75.Pp
76The
77.Ar owner
78and
79.Ar group
80operands are both optional, however, one must be specified.
81If the
82.Ar group
83operand is specified, it must be preceded by a colon (``:'') character.
84.Pp
85The
86.Ar owner
87may be either a numeric user ID or a user name.
88If a user name is also a numeric user ID, the operand is used as a
89user name.
90The
91.Ar group
92may be either a numeric group ID or a group name.
93If a group name is also a numeric group ID, the operand is used as a
94group name.
95.Pp
96The ownership of a file may only be altered by a super-user for
97obvious security reasons.
98.Pp
99The
100.Nm chown
101utility exits 0 on success, and >0 if an error occurs.
102.Sh COMPATIBILITY
103Previous versions of the
104.Nm chown
105utility used the dot (``.'') character to distinguish the group name.
106This has been changed to be a colon (``:'') character so that user and
107group names may contain the dot character.
108.Pp
109Previous versions of the
110.Nm chown
111utility changed the owner of symbolic links specified on the command
112line.
113In this system, symbolic links do not have owners.
114.Sh SEE ALSO
115.Xr chgrp 1 ,
116.Xr find 1 ,
117.Xr chown 2 ,
118.Xr fts 3 ,
119.Xr symlink 7
120.Sh STANDARDS
121The
122.Nm chown
123command is expected to be POSIX 1003.2 compliant.
124