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 "Jul 11, 2008"
15 chown \- change file ownership
20 \fB/usr/bin/chown\fR [\fB-fhR\fR] \fIowner\fR[:\fIgroup\fR] \fIfile\fR...
25 \fB/usr/bin/chown\fR \fB-s\fR [\fB-fhR\fR] \fIownersid\fR[:\fIgroupsid\fR] \fIfile\fR...
30 \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...
35 \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...
38 .SS "/usr/xpg4/bin/chown"
41 \fB/usr/xpg4/bin/chown\fR [\fB-fhR\fR] \fIowner\fR[:\fIgroup\fR] \fIfile\fR...
46 \fB/usr/xpg4/bin/chown\fR \fB-s\fR [\fB-fhR\fR] \fIownersid\fR[:\fIgroupsid\fR] \fIfile\fR...
51 \fB/usr/xpg4/bin/chown\fR \fB-R\fR [\fB-f\fR] [\fB-H\fR | \fB-L\fR | \fB-P\fR] \fIowner\fR[:\fIgroup\fR] \fIfile\fR...
56 \fB/usr/xpg4/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...
62 \fBchown\fR [\fB-cflhmnvHLPRX\fR] [\fB-r\fR \fIfile\fR] \fIowner\fR[:\fIgroup\fR] \fIfile\fR...
66 .SS "/usr/bin/chown and /usr/xpg4/bin/chown"
69 The \fBchown\fR utility sets the user \fBID\fR of the file named by each
70 \fBfile\fR to the user \fBID\fR specified by \fIowner\fR, and, optionally, sets
71 the group \fBID\fR to that specified by \fIgroup\fR.
74 If \fBchown\fR is invoked by other than the super-user, the set-user-\fBID\fR
78 Only the owner of a file (or the super-user) can change the owner of that file.
81 The operating system has a configuration option
82 \fB{_POSIX_CHOWN_RESTRICTED}\fR, to restrict ownership changes. When this
83 option is in effect the owner of the file is prevented from changing the owner
84 \fBID\fR of the file. Only the super-user can arbitrarily change owner
85 \fBID\fRs whether or not this option is in effect. To set this configuration
86 option, include the following line in \fB/etc/system\fR:
90 \fBset rstchown = 1\fR
97 To disable this option, include the following line in \fB/etc/system\fR:
101 \fBset rstchown = 0\fR
108 \fB{_POSIX_CHOWN_RESTRICTED}\fR is enabled by default. See \fBsystem\fR(4) and
113 The \fBchown\fR built-in in \fBksh93\fR is associated with the \fB/bin\fR and
114 \fB/usr/bin\fR paths. It is invoked when \fBchown\fR is executed without a
115 pathname prefix and the pathname search finds a \fB/bin/chown\fR or
116 /usr/bin/chown executable.
119 \fBchown\fR changes the ownership of each file to \fIowner\fR. \fIowner\fR can
120 be specified as either a user name or a numeric user id. The group ownership of
121 each file can also be changed to \fIgroup\fR by appending \fI:group\fR to the
124 .SS "/usr/bin/chown and /usr/xpg4/bin/chown"
127 The following options are supported:
134 Force. Does not report errors.
143 If the file is a symbolic link, this option changes the owner of the symbolic
144 link. Without this option, the owner of the file referenced by the symbolic
154 If the file specified on the command line is a symbolic link referencing a file
155 of type directory, this option changes the owner of the directory referenced by
156 the symbolic link and all the files in the file hierarchy below it. If a
157 symbolic link is encountered when traversing a file hierarchy, the owner of the
158 target file is changed, but no recursion takes place.
167 If the file is a symbolic link, this option changes the owner of the file
168 referenced by the symbolic link. If the file specified on the command line, or
169 encountered during the traversal of the file hierarchy, is a symbolic link
170 referencing a file of type directory, then this option changes the owner of the
171 directory referenced by the symbolic link and all files in the file hierarchy
181 If the file specified on the command line or encountered during the traversal
182 of a file hierarchy is a symbolic link, this option changes the owner of the
183 symbolic link. This option does not follow the symbolic link to any other part
184 of the file hierarchy.
193 The owner and/or group arguments are Windows SID strings. This option requires
194 a file system that supports storing SIDs, such as ZFS.
199 Specifying more than one of the mutually-exclusive options \fB-H\fR, \fB-L\fR,
200 or \fB-P\fR is not considered an error. The last option specified determines
201 the behavior of \fBchown\fR.
205 The following options are supported:
212 Recursive. \fBchown\fR descends through the directory, and any subdirectories,
213 setting the specified ownership \fBID\fR as it proceeds. When a symbolic link
214 is encountered, the owner of the target file is changed, unless the \fB-h\fR or
215 \fB-P\fR option is specified. However, no recursion takes place, unless the
216 \fB-H\fR or \fB-L\fR option is specified.
219 .SS "/usr/xpg4/bin/chown"
222 The following options are supported:
229 Recursive. \fBchown\fR descends through the directory, and any subdirectories,
230 setting the specified ownership \fBID\fR as it proceeds. When a symbolic link
231 is encountered, the owner of the target file is changed, unless the \fB-h\fR or
232 \fB-P\fR option is specified. Unless the \fB-H\fR, \fB-L\fR, or \fB-P\fR option
233 is specified, the \fB-L\fR option is used as the default mode.
239 The following options are supported by the \fBksh93\fR built-in \fBchown\fR
248 \fB\fB--changes\fR\fR
252 Describe only files whose ownership actually changes.
262 \fB\fB--quiet | silent\fR\fR
266 Do not report files whose ownership fails to change.
276 \fB\fB--symlink\fR\fR
280 Change the ownership of the symbolic links on systems that support this option.
294 Interpret the first operand as a file that contains a map of:
298 \fIfrom_uid\fR:\fIfrom_gid to_uid:to_gid\fR
303 pairs. Ownership of files matching the \fIfrom\fR part of any pair is changed
304 to the corresponding \fIto\fR part of the pair. The process stops at the first
305 match for each file. Unmatched files are silently ignored.
319 Show actions but do not execute.
329 \fB\fB--reference=file\fR\fR
333 Omit the explicit ownership operand and use the ownership of the file instead.
343 \fB\fB--verbose\fR\fR
347 Describe the changed permissions of all files.
357 \fB\fB--metaphysical\fR\fR
361 Follow symbolic links for command arguments. Otherwise do not follow symbolic
362 links when traversing directories.
372 \fB\fB--logical | follow\fR\fR
376 Follow symbolic links when traversing directories.
386 \fB\fB--physical | nofollow\fR\fR
390 Do not follow symbolic links when traversing directories.
400 \fB\fB--recursive\fR\fR
404 Recursively change ownership of directories and their contents.
418 Canonicalize output for testing.
424 The following operands are supported:
428 \fB\fIowner\fR[\fB:\fR\fIgroup\fR]\fR
431 A user \fBID\fR and optional group \fBID\fR to be assigned to \fBfile\fR. The
432 \fIowner\fR portion of this operand must be a user name from the user database
433 or a numeric user \fBID\fR. Either specifies a user \fBID\fR to be given to
434 each file named by \fIfile\fR. If a numeric \fIowner\fR exists in the user
435 database as a user name, the user \fBID\fR number associated with that user
436 name is used as the user \fBID\fR. Similarly, if the \fIgroup\fR portion of
437 this operand is present, it must be a group name from the group database or a
438 numeric group \fBID\fR. Either specifies a group \fBID\fR to be given to each
439 file. If a numeric group operand exists in the group database as a group name,
440 the group \fBID\fR number associated with that group name is used as the group
450 A path name of a file whose user \fBID\fR is to be modified.
456 See \fBlargefile\fR(5) for the description of the behavior of \fBchown\fR when
457 encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
460 \fBExample 1 \fRChanging Ownership of All Files in the Hierarchy
463 The following command changes ownership of all files in the hierarchy,
464 including symbolic links, but not the targets of the links:
469 example% \fBchown \(miR \(mih \fIowner\fR[:group] \fIfile\fR...\fR
474 .SH ENVIRONMENT VARIABLES
477 See \fBenviron\fR(5) for descriptions of the following environment variables
478 that affect the execution of \fBchown\fR: \fBLANG\fR, \fBLC_ALL\fR,
479 \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
483 The following exit values are returned:
490 The utility executed successfully and all requested changes were made.
506 \fB\fB/etc/passwd\fR\fR
515 See \fBattributes\fR(5) for descriptions of the following attributes:
524 ATTRIBUTE TYPE ATTRIBUTE VALUE
526 CSI Enabled. See NOTES.
528 Interface Stability Committed
530 Standard See \fBstandards\fR(5).
533 .SS "/usr/xpg4/bin/chown"
541 ATTRIBUTE TYPE ATTRIBUTE VALUE
543 CSI Enabled. See \fBNOTES\fR.
545 Interface Stability Committed
547 Standard See \fBstandards\fR(5).
558 ATTRIBUTE TYPE ATTRIBUTE VALUE
560 Interface Stability See below.
565 The \fBksh93\fR built-in binding to \fB/bin\fR and \fB/usr/bin\fR is Volatile.
566 The built-in interfaces are Uncommitted.
570 \fBchgrp\fR(1), \fBchmod\fR(1), \fBksh93\fR(1), \fBchown\fR(2),
571 \fBfpathconf\fR(2), \fBpasswd\fR(4), \fBsystem\fR(4), \fBattributes\fR(5),
572 \fBenviron\fR(5), \fBlargefile\fR(5), \fBstandards\fR(5)
576 \fBchown\fR is \fBCSI\fR-enabled except for the \fIowner\fR and \fIgroup\fR