BSD 4_4 release
[unix-history] / usr / src / usr.sbin / chown / chown.8
CommitLineData
ad787160
C
1.\" Copyright (c) 1990, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
15102292 3.\"
ad787160
C
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\" notice, this list of conditions and the following disclaimer in the
11.\" documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\" must display the following acknowledgement:
14.\" This product includes software developed by the University of
15.\" California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\" may be used to endorse or promote products derived from this software
18.\" without specific prior written permission.
15102292 19.\"
ad787160
C
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
15102292 31.\"
ad787160
C
32.\" @(#)chown.8 8.1 (Berkeley) 6/29/93
33.\"
34.Dd June 29, 1993
b42074ab
CL
35.Dt CHOWN 8
36.Os BSD 4
37.Sh NAME
38.Nm chown
39.Nd change file owner and group
40.Sh SYNOPSIS
41.Nm chown
d109ab63 42.Op Fl HRfh
ca414e03
KB
43.Ar owner Op Ar :group
44.Ar file ...
45.Nm chown
0daef752 46.Op Fl HRfh
ca414e03 47.Ar :group
b42074ab
CL
48.Ar file ...
49.Sh DESCRIPTION
50.Nm Chown
a7bd3fcd 51sets the user ID and/or the group ID of the specified files.
b42074ab 52.Pp
a7bd3fcd 53The options are as follows:
b42074ab 54.Bl -tag -width Ds
0daef752
EA
55.It Fl H
56When encountering a symbolic link on the command line, follow it. All other
57symbolic links encountered in the traversal are not followed.
b42074ab 58.It Fl R
a7bd3fcd
KB
59Change the user ID and/or the group ID for the file hierarchies rooted
60in the files instead of just the files themselves.
b42074ab 61.It Fl f
a7bd3fcd
KB
62Don't report any failure to change file owner or group, nor modify
63the exit status to reflect such failures.
0daef752 64.It Fl h
d109ab63 65When encountering a symbolic link anywhere in the traversal, follow it.
b42074ab
CL
66.El
67.Pp
ad787160 68The ownership of a symbolic link is immutable, so unless the
0daef752
EA
69.Fl h
70or
71.Fl H
ad787160 72flag is set,
0daef752 73.Nm chown
d109ab63 74on a symbolic link is a no-op.
0daef752 75.Pp
a7bd3fcd 76The
b42074ab 77.Ar owner
a7bd3fcd 78and
b42074ab 79.Ar group
ca414e03
KB
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.
b42074ab 84.Pp
a7bd3fcd 85The
b42074ab
CL
86.Ar owner
87may be either a numeric user ID or a user name.
a7bd3fcd
KB
88If a user name is also a numeric user ID, the operand is used as a
89user name.
90The
b42074ab
CL
91.Ar group
92may be either a numeric group ID or a group name.
a7bd3fcd
KB
93If a group name is also a numeric group ID, the operand is used as a
94group name.
b42074ab
CL
95.Pp
96The ownership of a file may only be altered by a super-user for
97obvious security reasons.
98.Pp
a7bd3fcd 99The
b42074ab 100.Nm chown
a7bd3fcd 101utility exits 0 on success, and >0 if an error occurs.
b42074ab 102.Sh COMPATIBILITY
a7bd3fcd 103Previous versions of the
b42074ab 104.Nm chown
a7bd3fcd
KB
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.
b42074ab
CL
108.Sh SEE ALSO
109.Xr chgrp 1 ,
110.Xr find 1 ,
0daef752 111.Xr chown 2 ,
0d17b9a2
KB
112.Xr fts 3 ,
113.Xr symlink 7
b42074ab
CL
114.Sh STANDARDS
115The
116.Nm chown
117command is expected to be POSIX 1003.2 compliant.