xref: /original-bsd/usr.sbin/chown/chown.8 (revision d5c53de2)
1b68612bdSbostic.\" Copyright (c) 1990, 1991, 1993, 1994
254bd01f0Sbostic.\"	The Regents of the University of California.  All rights reserved.
33de773c6Smckusick.\"
4303bdb60Sbostic.\" %sccs.include.redist.man%
5303bdb60Sbostic.\"
6*d5c53de2Sbostic.\"     @(#)chown.8	8.3 (Berkeley) 03/31/94
73de773c6Smckusick.\"
813251ec2Scael.Dd
913251ec2Scael.Dt CHOWN 8
1013251ec2Scael.Os BSD 4
1113251ec2Scael.Sh NAME
1213251ec2Scael.Nm chown
1313251ec2Scael.Nd change file owner and group
1413251ec2Scael.Sh SYNOPSIS
1513251ec2Scael.Nm chown
16b68612bdSbostic.Oo
17b68612bdSbostic.Fl R
18b68612bdSbostic.Op Fl H | Fl L | Fl P
19b68612bdSbostic.Oc
20b68612bdSbostic.Op Fl f
21c9bff8faSbostic.Ar owner Op Ar :group
22c9bff8faSbostic.Ar file ...
23c9bff8faSbostic.Nm chown
24b68612bdSbostic.Oo
25b68612bdSbostic.Fl R
26b68612bdSbostic.Op Fl H | Fl L | Fl P
27b68612bdSbostic.Oc
28b68612bdSbostic.Op Fl f
29c9bff8faSbostic.Ar :group
3013251ec2Scael.Ar file ...
3113251ec2Scael.Sh DESCRIPTION
3213251ec2Scael.Nm Chown
33303bdb60Sbosticsets the user ID and/or the group ID of the specified files.
3413251ec2Scael.Pp
35303bdb60SbosticThe options are as follows:
3613251ec2Scael.Bl -tag -width Ds
37b9c80ce6Selan.It Fl H
38b68612bdSbosticIf the
39b68612bdSbostic.Fl R
40b68612bdSbosticoption is specified, symbolic links on the command line are followed.
41b68612bdSbostic(Symbolic links encountered in the tree traversal are not followed.)
42b68612bdSbostic.It Fl L
43b68612bdSbosticIf the
44b68612bdSbostic.Fl R
45b68612bdSbosticoption is specified, all symbolic links are followed.
46b68612bdSbostic.It Fl P
47b68612bdSbosticIf the
48b68612bdSbostic.Fl R
49b68612bdSbosticoption is specified, no symbolic links are followed.
5013251ec2Scael.It Fl R
51303bdb60SbosticChange the user ID and/or the group ID for the file hierarchies rooted
52303bdb60Sbosticin the files instead of just the files themselves.
5313251ec2Scael.It Fl f
54303bdb60SbosticDon't report any failure to change file owner or group, nor modify
55303bdb60Sbosticthe exit status to reflect such failures.
5613251ec2Scael.El
5713251ec2Scael.Pp
58b68612bdSbosticSymbolic links don't have owners, so unless the
59b9c80ce6Selan.Fl H
60b68612bdSbosticor
61b68612bdSbostic.Fl L
62b68612bdSbosticoption is set,
63b9c80ce6Selan.Nm chown
64*d5c53de2Sbosticon a symbolic link always succeeds and has no effect.
65b68612bdSbosticThe
66b68612bdSbostic.Fl H ,
67b68612bdSbostic.Fl L
68b68612bdSbosticand
69b68612bdSbostic.Fl P
70b68612bdSbosticoptions are ignored unless the
71b68612bdSbostic.Fl R
72b68612bdSbosticoption is specified.
73b68612bdSbosticIn addition, these options override each other and the
74b68612bdSbosticcommand's actions are determined by the last one specified.
75b9c80ce6Selan.Pp
76303bdb60SbosticThe
7713251ec2Scael.Ar owner
78303bdb60Sbosticand
7913251ec2Scael.Ar group
80c9bff8faSbosticoperands are both optional, however, one must be specified.
81c9bff8faSbosticIf the
82c9bff8faSbostic.Ar group
83c9bff8faSbosticoperand is specified, it must be preceded by a colon (``:'') character.
8413251ec2Scael.Pp
85303bdb60SbosticThe
8613251ec2Scael.Ar owner
8713251ec2Scaelmay be either a numeric user ID or a user name.
88303bdb60SbosticIf a user name is also a numeric user ID, the operand is used as a
89303bdb60Sbosticuser name.
90303bdb60SbosticThe
9113251ec2Scael.Ar group
9213251ec2Scaelmay be either a numeric group ID or a group name.
93303bdb60SbosticIf a group name is also a numeric group ID, the operand is used as a
94303bdb60Sbosticgroup name.
9513251ec2Scael.Pp
9613251ec2ScaelThe ownership of a file may only be altered by a super-user for
9713251ec2Scaelobvious security reasons.
9813251ec2Scael.Pp
99303bdb60SbosticThe
10013251ec2Scael.Nm chown
101303bdb60Sbosticutility exits 0 on success, and >0 if an error occurs.
10213251ec2Scael.Sh COMPATIBILITY
103303bdb60SbosticPrevious versions of the
10413251ec2Scael.Nm chown
105303bdb60Sbosticutility used the dot (``.'') character to distinguish the group name.
106303bdb60SbosticThis has been changed to be a colon (``:'') character so that user and
107303bdb60Sbosticgroup names may contain the dot character.
108b68612bdSbostic.Pp
109b68612bdSbosticPrevious versions of the
110b68612bdSbostic.Nm chown
111b68612bdSbosticutility changed the owner of symbolic links specified on the command
112b68612bdSbosticline.
113b68612bdSbosticIn this system, symbolic links do not have owners.
11413251ec2Scael.Sh SEE ALSO
11513251ec2Scael.Xr chgrp 1 ,
11613251ec2Scael.Xr find 1 ,
117b9c80ce6Selan.Xr chown 2 ,
118733cb52eSbostic.Xr fts 3 ,
119733cb52eSbostic.Xr symlink 7
12013251ec2Scael.Sh STANDARDS
12113251ec2ScaelThe
12213251ec2Scael.Nm chown
12313251ec2Scaelcommand is expected to be POSIX 1003.2 compliant.
124