Commit | Line | Data |
---|---|---|
b42074ab | 1 | .\" Copyright (c) 1990, 1991 The Regents of the University of California. |
a7bd3fcd | 2 | .\" All rights reserved. |
15102292 | 3 | .\" |
a7bd3fcd KB |
4 | .\" %sccs.include.redist.man% |
5 | .\" | |
76229015 | 6 | .\" @(#)chown.8 6.11 (Berkeley) %G% |
15102292 | 7 | .\" |
b42074ab CL |
8 | .Dd |
9 | .Dt CHOWN 8 | |
10 | .Os BSD 4 | |
11 | .Sh NAME | |
12 | .Nm chown | |
13 | .Nd change file owner and group | |
14 | .Sh SYNOPSIS | |
15 | .Nm chown | |
d109ab63 | 16 | .Op Fl HRfh |
ca414e03 KB |
17 | .Ar owner Op Ar :group |
18 | .Ar file ... | |
19 | .Nm chown | |
0daef752 | 20 | .Op Fl HRfh |
ca414e03 | 21 | .Ar :group |
b42074ab CL |
22 | .Ar file ... |
23 | .Sh DESCRIPTION | |
24 | .Nm Chown | |
a7bd3fcd | 25 | sets the user ID and/or the group ID of the specified files. |
b42074ab | 26 | .Pp |
a7bd3fcd | 27 | The options are as follows: |
b42074ab | 28 | .Bl -tag -width Ds |
0daef752 EA |
29 | .It Fl H |
30 | When encountering a symbolic link on the command line, follow it. All other | |
31 | symbolic links encountered in the traversal are not followed. | |
b42074ab | 32 | .It Fl R |
a7bd3fcd KB |
33 | Change the user ID and/or the group ID for the file hierarchies rooted |
34 | in the files instead of just the files themselves. | |
b42074ab | 35 | .It Fl f |
a7bd3fcd KB |
36 | Don't report any failure to change file owner or group, nor modify |
37 | the exit status to reflect such failures. | |
0daef752 | 38 | .It Fl h |
d109ab63 | 39 | When encountering a symbolic link anywhere in the traversal, follow it. |
b42074ab CL |
40 | .El |
41 | .Pp | |
76229015 | 42 | The ownership of a symbolic link is immutable, so unless the |
0daef752 EA |
43 | .Fl h |
44 | or | |
45 | .Fl H | |
76229015 | 46 | flag is set, |
0daef752 | 47 | .Nm chown |
d109ab63 | 48 | on a symbolic link is a no-op. |
0daef752 | 49 | .Pp |
a7bd3fcd | 50 | The |
b42074ab | 51 | .Ar owner |
a7bd3fcd | 52 | and |
b42074ab | 53 | .Ar group |
ca414e03 KB |
54 | operands are both optional, however, one must be specified. |
55 | If the | |
56 | .Ar group | |
57 | operand is specified, it must be preceded by a colon (``:'') character. | |
b42074ab | 58 | .Pp |
a7bd3fcd | 59 | The |
b42074ab CL |
60 | .Ar owner |
61 | may be either a numeric user ID or a user name. | |
a7bd3fcd KB |
62 | If a user name is also a numeric user ID, the operand is used as a |
63 | user name. | |
64 | The | |
b42074ab CL |
65 | .Ar group |
66 | may be either a numeric group ID or a group name. | |
a7bd3fcd KB |
67 | If a group name is also a numeric group ID, the operand is used as a |
68 | group name. | |
b42074ab CL |
69 | .Pp |
70 | The ownership of a file may only be altered by a super-user for | |
71 | obvious security reasons. | |
72 | .Pp | |
a7bd3fcd | 73 | The |
b42074ab | 74 | .Nm chown |
a7bd3fcd | 75 | utility exits 0 on success, and >0 if an error occurs. |
b42074ab | 76 | .Sh COMPATIBILITY |
a7bd3fcd | 77 | Previous versions of the |
b42074ab | 78 | .Nm chown |
a7bd3fcd KB |
79 | utility used the dot (``.'') character to distinguish the group name. |
80 | This has been changed to be a colon (``:'') character so that user and | |
81 | group names may contain the dot character. | |
b42074ab CL |
82 | .Sh SEE ALSO |
83 | .Xr chgrp 1 , | |
84 | .Xr find 1 , | |
0daef752 | 85 | .Xr chown 2 , |
0d17b9a2 KB |
86 | .Xr fts 3 , |
87 | .Xr symlink 7 | |
b42074ab CL |
88 | .Sh STANDARDS |
89 | The | |
90 | .Nm chown | |
91 | command is expected to be POSIX 1003.2 compliant. |