2 .\" Copyright 1989 AT&T
3 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved
4 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
5 .\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures
6 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
7 .\" http://www.opengroup.org/bookstore/.
8 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
9 .\" This notice shall appear on any product containing this material.
10 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
11 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
12 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
13 .TH CHOWN 1 "Oct 25, 2017"
15 chown \- change file ownership
19 \fB/usr/bin/chown\fR [\fB-fhR\fR] \fIowner\fR[:\fIgroup\fR] \fIfile\fR...
24 \fB/usr/bin/chown\fR \fB-s\fR [\fB-fhR\fR] \fIownersid\fR[:\fIgroupsid\fR] \fIfile\fR...
29 \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...
34 \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...
40 \fBchown\fR [\fB-cflhmnvHLPRX\fR] [\fB-r\fR \fIfile\fR] \fIowner\fR[:\fIgroup\fR] \fIfile\fR...
46 The \fBchown\fR utility sets the user \fBID\fR of the file named by each
47 \fBfile\fR to the user \fBID\fR specified by \fIowner\fR, and, optionally, sets
48 the group \fBID\fR to that specified by \fIgroup\fR.
51 If \fBchown\fR is invoked by other than the super-user, the set-user-\fBID\fR
55 Only the owner of a file (or the super-user) can change the owner of that file.
58 The operating system has a configuration option
59 \fB{_POSIX_CHOWN_RESTRICTED}\fR, to restrict ownership changes. When this
60 option is in effect the owner of the file is prevented from changing the owner
61 \fBID\fR of the file. Only the super-user can arbitrarily change owner
62 \fBID\fRs whether or not this option is in effect. To set this configuration
63 option, include the following line in \fB/etc/system\fR:
67 \fBset rstchown = 1\fR
74 To disable this option, include the following line in \fB/etc/system\fR:
78 \fBset rstchown = 0\fR
85 \fB{_POSIX_CHOWN_RESTRICTED}\fR is enabled by default. See \fBsystem\fR(4) and
90 The \fBchown\fR built-in in \fBksh93\fR is associated with the \fB/bin\fR and
91 \fB/usr/bin\fR paths. It is invoked when \fBchown\fR is executed without a
92 pathname prefix and the pathname search finds a \fB/bin/chown\fR or
93 /usr/bin/chown executable.
96 \fBchown\fR changes the ownership of each file to \fIowner\fR. \fIowner\fR can
97 be specified as either a user name or a numeric user id. The group ownership of
98 each file can also be changed to \fIgroup\fR by appending \fI:group\fR to the
103 The following options are supported:
110 Force. Does not report errors.
119 If the file is a symbolic link, this option changes the owner of the symbolic
120 link. Without this option, the owner of the file referenced by the symbolic
130 If the file specified on the command line is a symbolic link referencing a file
131 of type directory, this option changes the owner of the directory referenced by
132 the symbolic link and all the files in the file hierarchy below it. If a
133 symbolic link is encountered when traversing a file hierarchy, the owner of the
134 target file is changed, but no recursion takes place.
143 If the file is a symbolic link, this option changes the owner of the file
144 referenced by the symbolic link. If the file specified on the command line, or
145 encountered during the traversal of the file hierarchy, is a symbolic link
146 referencing a file of type directory, then this option changes the owner of the
147 directory referenced by the symbolic link and all files in the file hierarchy
157 If the file specified on the command line or encountered during the traversal
158 of a file hierarchy is a symbolic link, this option changes the owner of the
159 symbolic link. This option does not follow the symbolic link to any other part
160 of the file hierarchy.
169 The owner and/or group arguments are Windows SID strings. This option requires
170 a file system that supports storing SIDs, such as ZFS.
175 Specifying more than one of the mutually-exclusive options \fB-H\fR, \fB-L\fR,
176 or \fB-P\fR is not considered an error. The last option specified determines
177 the behavior of \fBchown\fR.
186 Recursive. \fBchown\fR descends through the directory, and any subdirectories,
187 setting the specified ownership \fBID\fR as it proceeds. When a symbolic link
188 is encountered, the owner of the target file is changed, unless the \fB-h\fR or
189 \fB-P\fR option is specified. Unless the \fB-H\fR, \fB-L\fR, or \fB-P\fR option
190 is specified, the \fB-L\fR option is used as the default mode.
196 The following options are supported by the \fBksh93\fR built-in \fBchown\fR
205 \fB\fB--changes\fR\fR
209 Describe only files whose ownership actually changes.
219 \fB\fB--quiet | silent\fR\fR
223 Do not report files whose ownership fails to change.
233 \fB\fB--symlink\fR\fR
237 Change the ownership of the symbolic links on systems that support this option.
251 Interpret the first operand as a file that contains a map of:
255 \fIfrom_uid\fR:\fIfrom_gid to_uid:to_gid\fR
260 pairs. Ownership of files matching the \fIfrom\fR part of any pair is changed
261 to the corresponding \fIto\fR part of the pair. The process stops at the first
262 match for each file. Unmatched files are silently ignored.
276 Show actions but do not execute.
286 \fB\fB--reference=file\fR\fR
290 Omit the explicit ownership operand and use the ownership of the file instead.
300 \fB\fB--verbose\fR\fR
304 Describe the changed permissions of all files.
314 \fB\fB--metaphysical\fR\fR
318 Follow symbolic links for command arguments. Otherwise do not follow symbolic
319 links when traversing directories.
329 \fB\fB--logical | follow\fR\fR
333 Follow symbolic links when traversing directories.
343 \fB\fB--physical | nofollow\fR\fR
347 Do not follow symbolic links when traversing directories.
357 \fB\fB--recursive\fR\fR
361 Recursively change ownership of directories and their contents.
375 Canonicalize output for testing.
381 The following operands are supported:
385 \fB\fIowner\fR[\fB:\fR\fIgroup\fR]\fR
388 A user \fBID\fR and optional group \fBID\fR to be assigned to \fBfile\fR. The
389 \fIowner\fR portion of this operand must be a user name from the user database
390 or a numeric user \fBID\fR. Either specifies a user \fBID\fR to be given to
391 each file named by \fIfile\fR. If a numeric \fIowner\fR exists in the user
392 database as a user name, the user \fBID\fR number associated with that user
393 name is used as the user \fBID\fR. Similarly, if the \fIgroup\fR portion of
394 this operand is present, it must be a group name from the group database or a
395 numeric group \fBID\fR. Either specifies a group \fBID\fR to be given to each
396 file. If a numeric group operand exists in the group database as a group name,
397 the group \fBID\fR number associated with that group name is used as the group
407 A path name of a file whose user \fBID\fR is to be modified.
413 See \fBlargefile\fR(5) for the description of the behavior of \fBchown\fR when
414 encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
417 \fBExample 1 \fRChanging Ownership of All Files in the Hierarchy
420 The following command changes ownership of all files in the hierarchy,
421 including symbolic links, but not the targets of the links:
426 example% \fBchown \(miR \(mih \fIowner\fR[:group] \fIfile\fR...\fR
431 .SH ENVIRONMENT VARIABLES
434 See \fBenviron\fR(5) for descriptions of the following environment variables
435 that affect the execution of \fBchown\fR: \fBLANG\fR, \fBLC_ALL\fR,
436 \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
440 The following exit values are returned:
447 The utility executed successfully and all requested changes were made.
463 \fB\fB/etc/passwd\fR\fR
472 See \fBattributes\fR(5) for descriptions of the following attributes:
481 ATTRIBUTE TYPE ATTRIBUTE VALUE
483 CSI Enabled. See \fBNOTES\fR.
485 Interface Stability Committed
487 Standard See \fBstandards\fR(5).
498 ATTRIBUTE TYPE ATTRIBUTE VALUE
500 Interface Stability See below.
505 The \fBksh93\fR built-in binding to \fB/bin\fR and \fB/usr/bin\fR is Volatile.
506 The built-in interfaces are Uncommitted.
510 \fBchgrp\fR(1), \fBchmod\fR(1), \fBksh93\fR(1), \fBchown\fR(2),
511 \fBfpathconf\fR(2), \fBpasswd\fR(4), \fBsystem\fR(4), \fBattributes\fR(5),
512 \fBenviron\fR(5), \fBlargefile\fR(5), \fBstandards\fR(5)
516 \fBchown\fR is \fBCSI\fR-enabled except for the \fIowner\fR and \fIgroup\fR