xref: /freebsd/usr.sbin/chown/chown.8 (revision ad34cace157419ddfc3e717c3b70171c2e4273a5)
1dea673e9SRodney W. Grimes.\" Copyright (c) 1990, 1991, 1993, 1994
2dea673e9SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
3dea673e9SRodney W. Grimes.\"
4dea673e9SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
5dea673e9SRodney W. Grimes.\" modification, are permitted provided that the following conditions
6dea673e9SRodney W. Grimes.\" are met:
7dea673e9SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
8dea673e9SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
9dea673e9SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
10dea673e9SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
11dea673e9SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
12dea673e9SRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors
13dea673e9SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
14dea673e9SRodney W. Grimes.\"    without specific prior written permission.
15dea673e9SRodney W. Grimes.\"
16dea673e9SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17dea673e9SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18dea673e9SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19dea673e9SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20dea673e9SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21dea673e9SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22dea673e9SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23dea673e9SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24dea673e9SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25dea673e9SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26dea673e9SRodney W. Grimes.\" SUCH DAMAGE.
27dea673e9SRodney W. Grimes.\"
28dea673e9SRodney W. Grimes.\"     @(#)chown.8	8.3 (Berkeley) 3/31/94
2997d92980SPeter Wemm.\" $FreeBSD$
30dea673e9SRodney W. Grimes.\"
31*ad34caceSSteven Hartland.Dd April 20, 2015
32dea673e9SRodney W. Grimes.Dt CHOWN 8
33a4c37c81SRuslan Ermilov.Os
34dea673e9SRodney W. Grimes.Sh NAME
35dea673e9SRodney W. Grimes.Nm chown
36dea673e9SRodney W. Grimes.Nd change file owner and group
37dea673e9SRodney W. Grimes.Sh SYNOPSIS
38e97407b4SRuslan Ermilov.Nm
391901b124SGavin Atkinson.Op Fl fhvx
40dea673e9SRodney W. Grimes.Oo
41dea673e9SRodney W. Grimes.Fl R
42dea673e9SRodney W. Grimes.Op Fl H | Fl L | Fl P
43dea673e9SRodney W. Grimes.Oc
44610a5778SRuslan Ermilov.Ar owner Ns Op : Ns Ar group
4547dec781SRuslan Ermilov.Ar
46e97407b4SRuslan Ermilov.Nm
471901b124SGavin Atkinson.Op Fl fhvx
48dea673e9SRodney W. Grimes.Oo
49dea673e9SRodney W. Grimes.Fl R
50dea673e9SRodney W. Grimes.Op Fl H | Fl L | Fl P
51dea673e9SRodney W. Grimes.Oc
52610a5778SRuslan Ermilov.No : Ns Ar group
53cc09f59aSPhilippe Charnier.Ar
54dea673e9SRodney W. Grimes.Sh DESCRIPTION
55490d5836SPhilippe CharnierThe
56490d5836SPhilippe Charnier.Nm
57490d5836SPhilippe Charnierutility changes the user ID and/or the group ID of the specified files.
584ace3392STom RhodesSymbolic links named by arguments are silently left unchanged unless
59a37bec1dSRuslan Ermilov.Fl h
604ace3392STom Rhodesis used.
61dea673e9SRodney W. Grimes.Pp
62dea673e9SRodney W. GrimesThe options are as follows:
63dea673e9SRodney W. Grimes.Bl -tag -width Ds
64dea673e9SRodney W. Grimes.It Fl H
65dea673e9SRodney W. GrimesIf the
66dea673e9SRodney W. Grimes.Fl R
67*ad34caceSSteven Hartlandoption is specified, symbolic links on the command line are followed
68*ad34caceSSteven Hartlandand hence unaffected by the command.
69*ad34caceSSteven Hartland(Symbolic links encountered during traversal are not followed.)
70dea673e9SRodney W. Grimes.It Fl L
71dea673e9SRodney W. GrimesIf the
72dea673e9SRodney W. Grimes.Fl R
73dea673e9SRodney W. Grimesoption is specified, all symbolic links are followed.
74dea673e9SRodney W. Grimes.It Fl P
75dea673e9SRodney W. GrimesIf the
76dea673e9SRodney W. Grimes.Fl R
77dea673e9SRodney W. Grimesoption is specified, no symbolic links are followed.
7895a09b05SRuslan ErmilovThis is the default.
79dea673e9SRodney W. Grimes.It Fl R
80*ad34caceSSteven HartlandChange the user ID and/or the group ID of the file hierarchies rooted
81*ad34caceSSteven Hartlandin the files, instead of just the files themselves.
820f2e01e0SGiorgos KeramidasBeware of unintentionally matching the
830f2e01e0SGiorgos Keramidas.Dq Pa ".."
840f2e01e0SGiorgos Keramidashard link to the parent directory when using wildcards like
850f2e01e0SGiorgos Keramidas.Dq Li ".*" .
86dea673e9SRodney W. Grimes.It Fl f
870227791bSRuslan ErmilovDo not report any failure to change file owner or group, nor modify
88dea673e9SRodney W. Grimesthe exit status to reflect such failures.
892e08522bSPeter Wemm.It Fl h
904ace3392STom RhodesIf the file is a symbolic link, change the user ID and/or the
914ace3392STom Rhodesgroup ID of the link itself.
925bb83b98SDavid E. O'Brien.It Fl v
935bb83b98SDavid E. O'BrienCause
945bb83b98SDavid E. O'Brien.Nm
955bb83b98SDavid E. O'Briento be verbose, showing files as the owner is modified.
96ae29e300SJohan KarlssonIf the
97ae29e300SJohan Karlsson.Fl v
98ae29e300SJohan Karlssonflag is specified more than once,
99ae29e300SJohan Karlsson.Nm
100ae29e300SJohan Karlssonwill print the filename, followed by the old and new numeric user/group ID.
1011901b124SGavin Atkinson.It Fl x
1021901b124SGavin AtkinsonFile system mount points are not traversed.
103dea673e9SRodney W. Grimes.El
104dea673e9SRodney W. Grimes.Pp
105dea673e9SRodney W. GrimesThe
106dea673e9SRodney W. Grimes.Fl H ,
107dea673e9SRodney W. Grimes.Fl L
108dea673e9SRodney W. Grimesand
109dea673e9SRodney W. Grimes.Fl P
110dea673e9SRodney W. Grimesoptions are ignored unless the
111dea673e9SRodney W. Grimes.Fl R
112dea673e9SRodney W. Grimesoption is specified.
113dea673e9SRodney W. GrimesIn addition, these options override each other and the
114dea673e9SRodney W. Grimescommand's actions are determined by the last one specified.
115dea673e9SRodney W. Grimes.Pp
116dea673e9SRodney W. GrimesThe
117dea673e9SRodney W. Grimes.Ar owner
118dea673e9SRodney W. Grimesand
119dea673e9SRodney W. Grimes.Ar group
120dea673e9SRodney W. Grimesoperands are both optional, however, one must be specified.
121dea673e9SRodney W. GrimesIf the
122dea673e9SRodney W. Grimes.Ar group
123dea673e9SRodney W. Grimesoperand is specified, it must be preceded by a colon (``:'') character.
124dea673e9SRodney W. Grimes.Pp
125dea673e9SRodney W. GrimesThe
126dea673e9SRodney W. Grimes.Ar owner
127dea673e9SRodney W. Grimesmay be either a numeric user ID or a user name.
128dea673e9SRodney W. GrimesIf a user name is also a numeric user ID, the operand is used as a
129dea673e9SRodney W. Grimesuser name.
130dea673e9SRodney W. GrimesThe
131dea673e9SRodney W. Grimes.Ar group
132dea673e9SRodney W. Grimesmay be either a numeric group ID or a group name.
133dea673e9SRodney W. GrimesIf a group name is also a numeric group ID, the operand is used as a
134dea673e9SRodney W. Grimesgroup name.
135dea673e9SRodney W. Grimes.Pp
136dea673e9SRodney W. GrimesThe ownership of a file may only be altered by a super-user for
137dea673e9SRodney W. Grimesobvious security reasons.
138a866e170SRuslan Ermilov.Sh EXIT STATUS
139d628d776SRuslan Ermilov.Ex -std
140dea673e9SRodney W. Grimes.Sh COMPATIBILITY
141dea673e9SRodney W. GrimesPrevious versions of the
142cc09f59aSPhilippe Charnier.Nm
143dea673e9SRodney W. Grimesutility used the dot (``.'') character to distinguish the group name.
144dea673e9SRodney W. GrimesThis has been changed to be a colon (``:'') character so that user and
145dea673e9SRodney W. Grimesgroup names may contain the dot character.
146dea673e9SRodney W. Grimes.Pp
1472e08522bSPeter WemmOn previous versions of this system, symbolic links did not have
1482e08522bSPeter Wemmowners.
1495bb83b98SDavid E. O'Brien.Pp
1505bb83b98SDavid E. O'BrienThe
1515bb83b98SDavid E. O'Brien.Fl v
1521901b124SGavin Atkinsonand
1531901b124SGavin Atkinson.Fl x
1541901b124SGavin Atkinsonoptions are non-standard and their use in scripts is not recommended.
155dea673e9SRodney W. Grimes.Sh SEE ALSO
156dea673e9SRodney W. Grimes.Xr chgrp 1 ,
157dea673e9SRodney W. Grimes.Xr find 1 ,
158dea673e9SRodney W. Grimes.Xr chown 2 ,
159dea673e9SRodney W. Grimes.Xr fts 3 ,
160dea673e9SRodney W. Grimes.Xr symlink 7
161dea673e9SRodney W. Grimes.Sh STANDARDS
162dea673e9SRodney W. GrimesThe
163cc09f59aSPhilippe Charnier.Nm
164490d5836SPhilippe Charnierutility is expected to be
165cc09f59aSPhilippe Charnier.St -p1003.2
166cc09f59aSPhilippe Charniercompliant.
167b8923d4cSWolfram Schneider.Sh HISTORY
168b8923d4cSWolfram SchneiderA
169b8923d4cSWolfram Schneider.Nm
170490d5836SPhilippe Charnierutility appeared in
171b8923d4cSWolfram Schneider.At v1 .
172