2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group. In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document. The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
25 .\" This notice shall appear on any product containing this material.
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
43 .\" Copyright 1989 AT&T
44 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
45 .\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures
46 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved
48 .TH CHOWN 1 "Oct 25, 2017"
50 chown \- change file ownership
54 \fB/usr/bin/chown\fR [\fB-fhR\fR] \fIowner\fR[:\fIgroup\fR] \fIfile\fR...
59 \fB/usr/bin/chown\fR \fB-s\fR [\fB-fhR\fR] \fIownersid\fR[:\fIgroupsid\fR] \fIfile\fR...
64 \fB/usr/bin/chown\fR \fB-R\fR [\fB-f\fR] [\fB-H\fR | \fB-L\fR | \fB-P\fR] \fIowner\fR[:\fIgroup\fR] \fIfile\fR...
69 \fB/usr/bin/chown\fR \fB-s\fR \fB-R\fR [\fB-f\fR] [\fB-H\fR | \fB-L\fR | \fB-P\fR] \fIownersid\fR[:\fIgroupsid\fR] \fIfile\fR...
75 \fBchown\fR [\fB-cflhmnvHLPRX\fR] [\fB-r\fR \fIfile\fR] \fIowner\fR[:\fIgroup\fR] \fIfile\fR...
81 The \fBchown\fR utility sets the user \fBID\fR of the file named by each
82 \fBfile\fR to the user \fBID\fR specified by \fIowner\fR, and, optionally, sets
83 the group \fBID\fR to that specified by \fIgroup\fR.
86 If \fBchown\fR is invoked by other than the super-user, the set-user-\fBID\fR
90 Only the owner of a file (or the super-user) can change the owner of that file.
93 The operating system has a configuration option
94 \fB{_POSIX_CHOWN_RESTRICTED}\fR, to restrict ownership changes. When this
95 option is in effect the owner of the file is prevented from changing the owner
96 \fBID\fR of the file. Only the super-user can arbitrarily change owner
97 \fBID\fRs whether or not this option is in effect. To set this configuration
98 option, include the following line in \fB/etc/system\fR:
102 \fBset rstchown = 1\fR
109 To disable this option, include the following line in \fB/etc/system\fR:
113 \fBset rstchown = 0\fR
120 \fB{_POSIX_CHOWN_RESTRICTED}\fR is enabled by default. See \fBsystem\fR(4) and
125 The \fBchown\fR built-in in \fBksh93\fR is associated with the \fB/bin\fR and
126 \fB/usr/bin\fR paths. It is invoked when \fBchown\fR is executed without a
127 pathname prefix and the pathname search finds a \fB/bin/chown\fR or
128 /usr/bin/chown executable.
131 \fBchown\fR changes the ownership of each file to \fIowner\fR. \fIowner\fR can
132 be specified as either a user name or a numeric user id. The group ownership of
133 each file can also be changed to \fIgroup\fR by appending \fI:group\fR to the
138 The following options are supported:
145 Force. Does not report errors.
154 If the file is a symbolic link, this option changes the owner of the symbolic
155 link. Without this option, the owner of the file referenced by the symbolic
165 If the file specified on the command line is a symbolic link referencing a file
166 of type directory, this option changes the owner of the directory referenced by
167 the symbolic link and all the files in the file hierarchy below it. If a
168 symbolic link is encountered when traversing a file hierarchy, the owner of the
169 target file is changed, but no recursion takes place.
178 If the file is a symbolic link, this option changes the owner of the file
179 referenced by the symbolic link. If the file specified on the command line, or
180 encountered during the traversal of the file hierarchy, is a symbolic link
181 referencing a file of type directory, then this option changes the owner of the
182 directory referenced by the symbolic link and all files in the file hierarchy
192 If the file specified on the command line or encountered during the traversal
193 of a file hierarchy is a symbolic link, this option changes the owner of the
194 symbolic link. This option does not follow the symbolic link to any other part
195 of the file hierarchy.
204 The owner and/or group arguments are Windows SID strings. This option requires
205 a file system that supports storing SIDs, such as ZFS.
210 Specifying more than one of the mutually-exclusive options \fB-H\fR, \fB-L\fR,
211 or \fB-P\fR is not considered an error. The last option specified determines
212 the behavior of \fBchown\fR.
221 Recursive. \fBchown\fR descends through the directory, and any subdirectories,
222 setting the specified ownership \fBID\fR as it proceeds. When a symbolic link
223 is encountered, the owner of the target file is changed, unless the \fB-h\fR or
224 \fB-P\fR option is specified. Unless the \fB-H\fR, \fB-L\fR, or \fB-P\fR option
225 is specified, the \fB-L\fR option is used as the default mode.
231 The following options are supported by the \fBksh93\fR built-in \fBchown\fR
240 \fB\fB--changes\fR\fR
244 Describe only files whose ownership actually changes.
254 \fB\fB--quiet | silent\fR\fR
258 Do not report files whose ownership fails to change.
268 \fB\fB--symlink\fR\fR
272 Change the ownership of the symbolic links on systems that support this option.
286 Interpret the first operand as a file that contains a map of:
290 \fIfrom_uid\fR:\fIfrom_gid to_uid:to_gid\fR
295 pairs. Ownership of files matching the \fIfrom\fR part of any pair is changed
296 to the corresponding \fIto\fR part of the pair. The process stops at the first
297 match for each file. Unmatched files are silently ignored.
311 Show actions but do not execute.
321 \fB\fB--reference=file\fR\fR
325 Omit the explicit ownership operand and use the ownership of the file instead.
335 \fB\fB--verbose\fR\fR
339 Describe the changed permissions of all files.
349 \fB\fB--metaphysical\fR\fR
353 Follow symbolic links for command arguments. Otherwise do not follow symbolic
354 links when traversing directories.
364 \fB\fB--logical | follow\fR\fR
368 Follow symbolic links when traversing directories.
378 \fB\fB--physical | nofollow\fR\fR
382 Do not follow symbolic links when traversing directories.
392 \fB\fB--recursive\fR\fR
396 Recursively change ownership of directories and their contents.
410 Canonicalize output for testing.
416 The following operands are supported:
420 \fB\fIowner\fR[\fB:\fR\fIgroup\fR]\fR
423 A user \fBID\fR and optional group \fBID\fR to be assigned to \fBfile\fR. The
424 \fIowner\fR portion of this operand must be a user name from the user database
425 or a numeric user \fBID\fR. Either specifies a user \fBID\fR to be given to
426 each file named by \fIfile\fR. If a numeric \fIowner\fR exists in the user
427 database as a user name, the user \fBID\fR number associated with that user
428 name is used as the user \fBID\fR. Similarly, if the \fIgroup\fR portion of
429 this operand is present, it must be a group name from the group database or a
430 numeric group \fBID\fR. Either specifies a group \fBID\fR to be given to each
431 file. If a numeric group operand exists in the group database as a group name,
432 the group \fBID\fR number associated with that group name is used as the group
442 A path name of a file whose user \fBID\fR is to be modified.
448 See \fBlargefile\fR(5) for the description of the behavior of \fBchown\fR when
449 encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
452 \fBExample 1 \fRChanging Ownership of All Files in the Hierarchy
455 The following command changes ownership of all files in the hierarchy,
456 including symbolic links, but not the targets of the links:
461 example% \fBchown \(miR \(mih \fIowner\fR[:group] \fIfile\fR...\fR
466 .SH ENVIRONMENT VARIABLES
469 See \fBenviron\fR(5) for descriptions of the following environment variables
470 that affect the execution of \fBchown\fR: \fBLANG\fR, \fBLC_ALL\fR,
471 \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
475 The following exit values are returned:
482 The utility executed successfully and all requested changes were made.
498 \fB\fB/etc/passwd\fR\fR
507 See \fBattributes\fR(5) for descriptions of the following attributes:
516 ATTRIBUTE TYPE ATTRIBUTE VALUE
518 CSI Enabled. See \fBNOTES\fR.
520 Interface Stability Committed
522 Standard See \fBstandards\fR(5).
533 ATTRIBUTE TYPE ATTRIBUTE VALUE
535 Interface Stability See below.
540 The \fBksh93\fR built-in binding to \fB/bin\fR and \fB/usr/bin\fR is Volatile.
541 The built-in interfaces are Uncommitted.
545 \fBchgrp\fR(1), \fBchmod\fR(1), \fBksh93\fR(1), \fBchown\fR(2),
546 \fBfpathconf\fR(2), \fBpasswd\fR(4), \fBsystem\fR(4), \fBattributes\fR(5),
547 \fBenviron\fR(5), \fBlargefile\fR(5), \fBstandards\fR(5)
551 \fBchown\fR is \fBCSI\fR-enabled except for the \fIowner\fR and \fIgroup\fR