Unleashed v1.4
[unleashed.git] / share / man / man1 / chown.1
blob81190841d2b27023e31bbed937d3a7a72be07936
1 .\"
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/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
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.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
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.
30 .\"
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.
35 .\"
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]
41 .\"
42 .\"
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
47 .\"
48 .TH CHOWN 1 "Oct 25, 2017"
49 .SH NAME
50 chown \- change file ownership
51 .SH SYNOPSIS
52 .LP
53 .nf
54 \fB/usr/bin/chown\fR [\fB-fhR\fR] \fIowner\fR[:\fIgroup\fR] \fIfile\fR...
55 .fi
57 .LP
58 .nf
59 \fB/usr/bin/chown\fR \fB-s\fR [\fB-fhR\fR] \fIownersid\fR[:\fIgroupsid\fR] \fIfile\fR...
60 .fi
62 .LP
63 .nf
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...
65 .fi
67 .LP
68 .nf
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...
70 .fi
72 .SS "ksh93"
73 .LP
74 .nf
75 \fBchown\fR [\fB-cflhmnvHLPRX\fR] [\fB-r\fR \fIfile\fR] \fIowner\fR[:\fIgroup\fR] \fIfile\fR...
76 .fi
78 .SH DESCRIPTION
79 .sp
80 .LP
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.
84 .sp
85 .LP
86 If \fBchown\fR is invoked by other than the super-user, the set-user-\fBID\fR
87 bit is cleared.
88 .sp
89 .LP
90 Only the owner of a file (or the super-user) can change the owner of that file.
91 .sp
92 .LP
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:
99 .sp
100 .in +2
102 \fBset rstchown = 1\fR
104 .in -2
109 To disable this option, include the following line in \fB/etc/system\fR:
111 .in +2
113 \fBset rstchown = 0\fR
115 .in -2
120 \fB{_POSIX_CHOWN_RESTRICTED}\fR is enabled by default. See \fBsystem\fR(4) and
121 \fBfpathconf\fR(2).
122 .SS "ksh93"
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
134 user name.
135 .SH OPTIONS
138 The following options are supported:
140 .ne 2
142 \fB\fB-f\fR\fR
144 .RS 6n
145 Force. Does not report errors.
149 .ne 2
151 \fB\fB-h\fR\fR
153 .RS 6n
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
156 link is changed.
160 .ne 2
162 \fB\fB-H\fR\fR
164 .RS 6n
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.
173 .ne 2
175 \fB\fB-L\fR\fR
177 .RS 6n
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
183 below it.
187 .ne 2
189 \fB\fB-P\fR\fR
191 .RS 6n
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.
199 .ne 2
201 \fB\fB-s\fR\fR
203 .RS 6n
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.
216 .ne 2
218 \fB\fB-R\fR\fR
220 .RS 6n
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.
228 .SS "ksh93"
231 The following options are supported by the \fBksh93\fR built-in \fBchown\fR
232 command:
234 .ne 2
236 \fB\fB-c\fR\fR
240 \fB\fB--changes\fR\fR
242 .sp .6
243 .RS 4n
244 Describe only files whose ownership actually changes.
248 .ne 2
250 \fB\fB-f\fR\fR
254 \fB\fB--quiet | silent\fR\fR
256 .sp .6
257 .RS 4n
258 Do not report files whose ownership fails to change.
262 .ne 2
264 \fB\fB-l | h\fR\fR
268 \fB\fB--symlink\fR\fR
270 .sp .6
271 .RS 4n
272 Change the ownership of the symbolic links on systems that support this option.
276 .ne 2
278 \fB\fB-m\fR\fR
282 \fB\fB--map\fR\fR
284 .sp .6
285 .RS 4n
286 Interpret the first operand as a file that contains a map of:
288 .in +2
290 \fIfrom_uid\fR:\fIfrom_gid  to_uid:to_gid\fR
292 .in -2
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.
301 .ne 2
303 \fB\fB-n\fR\fR
307 \fB\fB--show\fR\fR
309 .sp .6
310 .RS 4n
311 Show actions but do not execute.
315 .ne 2
317 \fB\fB-r\fR\fR
321 \fB\fB--reference=file\fR\fR
323 .sp .6
324 .RS 4n
325 Omit the explicit ownership operand and use the ownership of the file instead.
329 .ne 2
331 \fB\fB-v\fR\fR
335 \fB\fB--verbose\fR\fR
337 .sp .6
338 .RS 4n
339 Describe the changed permissions of all files.
343 .ne 2
345 \fB\fB-H\fR\fR
349 \fB\fB--metaphysical\fR\fR
351 .sp .6
352 .RS 4n
353 Follow symbolic links for command arguments. Otherwise do not follow symbolic
354 links when traversing directories.
358 .ne 2
360 \fB\fB-L\fR\fR
364 \fB\fB--logical | follow\fR\fR
366 .sp .6
367 .RS 4n
368 Follow symbolic links when traversing directories.
372 .ne 2
374 \fB\fB-P\fR\fR
378 \fB\fB--physical | nofollow\fR\fR
380 .sp .6
381 .RS 4n
382 Do not follow symbolic links when traversing directories.
386 .ne 2
388 \fB\fB-R\fR\fR
392 \fB\fB--recursive\fR\fR
394 .sp .6
395 .RS 4n
396 Recursively change ownership of directories and their contents.
400 .ne 2
402 \fB\fB-X\fR\fR
406 \fB\fB--test\fR\fR
408 .sp .6
409 .RS 4n
410 Canonicalize output for testing.
413 .SH OPERANDS
416 The following operands are supported:
418 .ne 2
420 \fB\fIowner\fR[\fB:\fR\fIgroup\fR]\fR
422 .RS 17n
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
433 \fBID\fR.
437 .ne 2
439 \fB\fIfile\fR\fR
441 .RS 17n
442 A path name of a file whose user \fBID\fR is to be modified.
445 .SH EXAMPLES
447 \fBExample 1 \fRChanging Ownership of All Files in the Hierarchy
450 The following command changes ownership of all files in the hierarchy,
451 including symbolic links, but not the targets of the links:
454 .in +2
456 example% \fBchown \(miR \(mih \fIowner\fR[:group] \fIfile\fR...\fR
458 .in -2
461 .SH ENVIRONMENT VARIABLES
464 See \fBenviron\fR(5) for descriptions of the following environment variables
465 that affect the execution of \fBchown\fR: \fBLANG\fR, \fBLC_ALL\fR,
466 \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
467 .SH EXIT STATUS
470 The following exit values are returned:
472 .ne 2
474 \fB\fB0\fR\fR
476 .RS 6n
477 The utility executed successfully and all requested changes were made.
481 .ne 2
483 \fB\fB>0\fR\fR
485 .RS 6n
486 An error occurred.
489 .SH FILES
491 .ne 2
493 \fB\fB/etc/passwd\fR\fR
495 .RS 15n
496 System password file
499 .SH ATTRIBUTES
502 See \fBattributes\fR(5) for descriptions of the following attributes:
503 .SS "/usr/bin/chown"
508 box;
509 c | c
510 l | l .
511 ATTRIBUTE TYPE  ATTRIBUTE VALUE
513 CSI     Enabled. See \fBNOTES\fR.
515 Interface Stability     Committed
517 Standard        See \fBstandards\fR(5).
520 .SS "ksh93"
525 box;
526 c | c
527 l | l .
528 ATTRIBUTE TYPE  ATTRIBUTE VALUE
530 Interface Stability     See below.
535 The \fBksh93\fR built-in binding to \fB/bin\fR and \fB/usr/bin\fR is Volatile.
536 The built-in interfaces are Uncommitted.
537 .SH SEE ALSO
540 \fBchgrp\fR(1), \fBchmod\fR(1), \fBksh93\fR(1), \fBchown\fR(2),
541 \fBfpathconf\fR(2), \fBpasswd\fR(4), \fBsystem\fR(4), \fBattributes\fR(5),
542 \fBenviron\fR(5), \fBstandards\fR(5)
543 .SH NOTES
546 \fBchown\fR is \fBCSI\fR-enabled except for the \fIowner\fR and \fIgroup\fR
547 names.