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