14b88c807SRodney W. Grimes.\" Copyright (c) 1989, 1990, 1993, 1994 24b88c807SRodney W. Grimes.\" The Regents of the University of California. All rights reserved. 34b88c807SRodney W. Grimes.\" 44b88c807SRodney W. Grimes.\" This code is derived from software contributed to Berkeley by 54b88c807SRodney W. Grimes.\" the Institute of Electrical and Electronics Engineers, Inc. 64b88c807SRodney W. Grimes.\" 74b88c807SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without 84b88c807SRodney W. Grimes.\" modification, are permitted provided that the following conditions 94b88c807SRodney W. Grimes.\" are met: 104b88c807SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright 114b88c807SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer. 124b88c807SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright 134b88c807SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer in the 144b88c807SRodney W. Grimes.\" documentation and/or other materials provided with the distribution. 154b88c807SRodney W. Grimes.\" 3. All advertising materials mentioning features or use of this software 164b88c807SRodney W. Grimes.\" must display the following acknowledgement: 174b88c807SRodney W. Grimes.\" This product includes software developed by the University of 184b88c807SRodney W. Grimes.\" California, Berkeley and its contributors. 194b88c807SRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors 204b88c807SRodney W. Grimes.\" may be used to endorse or promote products derived from this software 214b88c807SRodney W. Grimes.\" without specific prior written permission. 224b88c807SRodney W. Grimes.\" 234b88c807SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 244b88c807SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 254b88c807SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 264b88c807SRodney W. Grimes.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 274b88c807SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 284b88c807SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 294b88c807SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 304b88c807SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 314b88c807SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 324b88c807SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 334b88c807SRodney W. Grimes.\" SUCH DAMAGE. 344b88c807SRodney W. Grimes.\" 354b88c807SRodney W. Grimes.\" @(#)chmod.1 8.4 (Berkeley) 3/31/94 364b88c807SRodney W. Grimes.\" 374b88c807SRodney W. Grimes.Dd March 31, 1994 384b88c807SRodney W. Grimes.Dt CHMOD 1 394b88c807SRodney W. Grimes.Os 404b88c807SRodney W. Grimes.Sh NAME 414b88c807SRodney W. Grimes.Nm chmod 424b88c807SRodney W. Grimes.Nd change file modes 434b88c807SRodney W. Grimes.Sh SYNOPSIS 444b88c807SRodney W. Grimes.Nm chmod 454b88c807SRodney W. Grimes.Oo 464b88c807SRodney W. Grimes.Fl R 474b88c807SRodney W. Grimes.Op Fl H | Fl L | Fl P 484b88c807SRodney W. Grimes.Oc 494b88c807SRodney W. Grimes.Ar mode 504b88c807SRodney W. Grimes.Ar file ... 514b88c807SRodney W. Grimes.Sh DESCRIPTION 524b88c807SRodney W. GrimesThe 534b88c807SRodney W. Grimes.Nm chmod 544b88c807SRodney W. Grimesutility modifies the file mode bits of the listed files 554b88c807SRodney W. Grimesas specified by the 564b88c807SRodney W. Grimes.Ar mode 574b88c807SRodney W. Grimesoperand. 584b88c807SRodney W. Grimes.Pp 594b88c807SRodney W. GrimesThe options are as follows: 604b88c807SRodney W. Grimes.Bl -tag -width Ds 614b88c807SRodney W. Grimes.It Fl H 624b88c807SRodney W. GrimesIf the 634b88c807SRodney W. Grimes.Fl R 644b88c807SRodney W. Grimesoption is specified, symbolic links on the command line are followed. 654b88c807SRodney W. Grimes(Symbolic links encountered in the tree traversal are not followed.) 664b88c807SRodney W. Grimes.It Fl L 674b88c807SRodney W. GrimesIf the 684b88c807SRodney W. Grimes.Fl R 694b88c807SRodney W. Grimesoption is specified, all symbolic links are followed. 704b88c807SRodney W. Grimes.It Fl P 714b88c807SRodney W. GrimesIf the 724b88c807SRodney W. Grimes.Fl R 734b88c807SRodney W. Grimesoption is specified, no symbolic links are followed. 744b88c807SRodney W. Grimes.It Fl R 754b88c807SRodney W. GrimesChange the modes of the file hierarchies rooted in the files 764b88c807SRodney W. Grimesinstead of just the files themselves. 774b88c807SRodney W. Grimes.El 784b88c807SRodney W. Grimes.Pp 794b88c807SRodney W. GrimesSymbolic links do not have modes, so unless the 804b88c807SRodney W. Grimes.Fl H 814b88c807SRodney W. Grimesor 824b88c807SRodney W. Grimes.Fl L 834b88c807SRodney W. Grimesoption is set, 844b88c807SRodney W. Grimes.Nm chmod 854b88c807SRodney W. Grimeson a symbolic link always succeeds and has no effect. 864b88c807SRodney W. GrimesThe 874b88c807SRodney W. Grimes.Fl H , 884b88c807SRodney W. Grimes.Fl L 894b88c807SRodney W. Grimesand 904b88c807SRodney W. Grimes.Fl P 914b88c807SRodney W. Grimesoptions are ignored unless the 924b88c807SRodney W. Grimes.Fl R 934b88c807SRodney W. Grimesoption is specified. 944b88c807SRodney W. GrimesIn addition, these options override each other and the 954b88c807SRodney W. Grimescommand's actions are determined by the last one specified. 964b88c807SRodney W. Grimes.Pp 974b88c807SRodney W. GrimesOnly the owner of a file or the super-user is permitted to change 984b88c807SRodney W. Grimesthe mode of a file. 994b88c807SRodney W. Grimes.Pp 1004b88c807SRodney W. GrimesThe 1014b88c807SRodney W. Grimes.Nm chmod 1024b88c807SRodney W. Grimesutility exits 0 on success, and >0 if an error occurs. 1034b88c807SRodney W. Grimes.Sh MODES 1044b88c807SRodney W. GrimesModes may be absolute or symbolic. 1054b88c807SRodney W. GrimesAn absolute mode is an octal number constructed by 1064b88c807SRodney W. Grimes.Ar or-ing 1074b88c807SRodney W. Grimesthe following values: 1084b88c807SRodney W. Grimes.Pp 1094b88c807SRodney W. Grimes.Bl -tag -width 6n -compact -offset indent 1104b88c807SRodney W. Grimes.It Li 4000 1114b88c807SRodney W. Grimesset-user-ID-on-execution 1124b88c807SRodney W. Grimes.It Li 2000 1134b88c807SRodney W. Grimesset-group-ID-on-execution 1144b88c807SRodney W. Grimes.It Li 1000 1154b88c807SRodney W. Grimessticky bit, see chmod(2) 1164b88c807SRodney W. Grimes.It Li 0400 1174b88c807SRodney W. Grimesread by owner 1184b88c807SRodney W. Grimes.It Li 0200 1194b88c807SRodney W. Grimeswrite by owner 1204b88c807SRodney W. Grimes.It Li 0100 1214b88c807SRodney W. Grimesexecute (or search for directories) by owner 1224b88c807SRodney W. Grimes.It Li 0070 1234b88c807SRodney W. Grimesread, write, execute/search by group 1244b88c807SRodney W. Grimes.It Li 0007 1254b88c807SRodney W. Grimesread, write, execute/search by others 1264b88c807SRodney W. Grimes.El 1274b88c807SRodney W. Grimes.Pp 1284b88c807SRodney W. GrimesThe read, write, and execute/search values for group and others 1294b88c807SRodney W. Grimesare encoded as described for owner. 1304b88c807SRodney W. Grimes.Pp 1314b88c807SRodney W. GrimesThe symbolic mode is described by the following grammar: 1324b88c807SRodney W. Grimes.Bd -literal -offset indent 1334b88c807SRodney W. Grimesmode ::= clause [, clause ...] 1344b88c807SRodney W. Grimesclause ::= [who ...] [action ...] last_action 1354b88c807SRodney W. Grimesaction ::= op [perm ...] 1364b88c807SRodney W. Grimeslast_action ::= op [perm ...] 1374b88c807SRodney W. Grimeswho ::= a | u | g | o 1384b88c807SRodney W. Grimesop ::= + | \- | = 1394b88c807SRodney W. Grimesperm ::= r | s | t | w | x | X | u | g | o 1404b88c807SRodney W. Grimes.Ed 1414b88c807SRodney W. Grimes.Pp 1424b88c807SRodney W. GrimesThe 1434b88c807SRodney W. Grimes.Ar who 1444b88c807SRodney W. Grimessymbols ``u'', ``g'', and ``o'' specify the user, group, and other parts 1454b88c807SRodney W. Grimesof the mode bits, respectively. 1464b88c807SRodney W. GrimesThe 1474b88c807SRodney W. Grimes.Ar who 1484b88c807SRodney W. Grimessymbol ``a'' is equivalent to ``ugo''. 1494b88c807SRodney W. Grimes.Pp 1504b88c807SRodney W. Grimes.ne 1i 1514b88c807SRodney W. GrimesThe 1524b88c807SRodney W. Grimes.Ar perm 1534b88c807SRodney W. Grimessymbols represent the portions of the mode bits as follows: 1544b88c807SRodney W. Grimes.Pp 1554b88c807SRodney W. Grimes.Bl -tag -width Ds -compact -offset indent 1564b88c807SRodney W. Grimes.It r 1574b88c807SRodney W. GrimesThe read bits. 1584b88c807SRodney W. Grimes.It s 1594b88c807SRodney W. GrimesThe set-user-ID-on-execution and set-group-ID-on-execution bits. 1604b88c807SRodney W. Grimes.It t 1614b88c807SRodney W. GrimesThe sticky bit. 1624b88c807SRodney W. Grimes.It w 1634b88c807SRodney W. GrimesThe write bits. 1644b88c807SRodney W. Grimes.It x 1654b88c807SRodney W. GrimesThe execute/search bits. 1664b88c807SRodney W. Grimes.It X 1674b88c807SRodney W. GrimesThe execute/search bits if the file is a directory or any of the 1684b88c807SRodney W. Grimesexecute/search bits are set in the original (unmodified) mode. 1694b88c807SRodney W. GrimesOperations with the 1704b88c807SRodney W. Grimes.Ar perm 1714b88c807SRodney W. Grimessymbol ``X'' are only meaningful in conjunction with the 1724b88c807SRodney W. Grimes.Ar op 1734b88c807SRodney W. Grimessymbol ``+'', and are ignored in all other cases. 1744b88c807SRodney W. Grimes.It u 1754b88c807SRodney W. GrimesThe user permission bits in the mode of the original file. 1764b88c807SRodney W. Grimes.It g 1774b88c807SRodney W. GrimesThe group permission bits in the mode of the original file. 1784b88c807SRodney W. Grimes.It o 1794b88c807SRodney W. GrimesThe other permission bits in the mode of the original file. 1804b88c807SRodney W. Grimes.El 1814b88c807SRodney W. Grimes.Pp 1824b88c807SRodney W. GrimesThe 1834b88c807SRodney W. Grimes.Ar op 1844b88c807SRodney W. Grimessymbols represent the operation performed, as follows: 1854b88c807SRodney W. Grimes.Bl -tag -width 4n 1864b88c807SRodney W. Grimes.It + 1874b88c807SRodney W. GrimesIf no value is supplied for 1884b88c807SRodney W. Grimes.Ar perm , 1894b88c807SRodney W. Grimesthe ``+'' operation has no effect. 1904b88c807SRodney W. GrimesIf no value is supplied for 1914b88c807SRodney W. Grimes.Ar who , 1924b88c807SRodney W. Grimeseach permission bit specified in 1934b88c807SRodney W. Grimes.Ar perm , 1944b88c807SRodney W. Grimesfor which the corresponding bit in the file mode creation mask 1954b88c807SRodney W. Grimesis clear, is set. 1964b88c807SRodney W. GrimesOtherwise, the mode bits represented by the specified 1974b88c807SRodney W. Grimes.Ar who 1984b88c807SRodney W. Grimesand 1994b88c807SRodney W. Grimes.Ar perm 2004b88c807SRodney W. Grimesvalues are set. 2014b88c807SRodney W. Grimes.It \&\- 2024b88c807SRodney W. GrimesIf no value is supplied for 2034b88c807SRodney W. Grimes.Ar perm , 2044b88c807SRodney W. Grimesthe ``\-'' operation has no effect. 2054b88c807SRodney W. GrimesIf no value is supplied for 2064b88c807SRodney W. Grimes.Ar who , 2074b88c807SRodney W. Grimeseach permission bit specified in 2084b88c807SRodney W. Grimes.Ar perm , 2094b88c807SRodney W. Grimesfor which the corresponding bit in the file mode creation mask 2104b88c807SRodney W. Grimesis clear, is cleared. 2114b88c807SRodney W. GrimesOtherwise, the mode bits represented by the specified 2124b88c807SRodney W. Grimes.Ar who 2134b88c807SRodney W. Grimesand 2144b88c807SRodney W. Grimes.Ar perm 2154b88c807SRodney W. Grimesvalues are cleared. 2164b88c807SRodney W. Grimes.It = 2174b88c807SRodney W. GrimesThe mode bits specified by the 2184b88c807SRodney W. Grimes.Ar who 2194b88c807SRodney W. Grimesvalue are cleared, or, if no who value is specified, the owner, group 2204b88c807SRodney W. Grimesand other mode bits are cleared. 2214b88c807SRodney W. GrimesThen, if no value is supplied for 2224b88c807SRodney W. Grimes.Ar who , 2234b88c807SRodney W. Grimeseach permission bit specified in 2244b88c807SRodney W. Grimes.Ar perm , 2254b88c807SRodney W. Grimesfor which the corresponding bit in the file mode creation mask 2264b88c807SRodney W. Grimesis clear, is set. 2274b88c807SRodney W. GrimesOtherwise, the mode bits represented by the specified 2284b88c807SRodney W. Grimes.Ar who 2294b88c807SRodney W. Grimesand 2304b88c807SRodney W. Grimes.Ar perm 2314b88c807SRodney W. Grimesvalues are set. 2324b88c807SRodney W. Grimes.El 2334b88c807SRodney W. Grimes.Pp 2344b88c807SRodney W. GrimesEach 2354b88c807SRodney W. Grimes.Ar clause 2364b88c807SRodney W. Grimesspecifies one or more operations to be performed on the mode 2374b88c807SRodney W. Grimesbits, and each operation is applied to the mode bits in the 2384b88c807SRodney W. Grimesorder specified. 2394b88c807SRodney W. Grimes.Pp 2404b88c807SRodney W. GrimesOperations upon the other permissions only (specified by the symbol 2414b88c807SRodney W. Grimes``o'' by itself), in combination with the 2424b88c807SRodney W. Grimes.Ar perm 2434b88c807SRodney W. Grimessymbols ``s'' or ``t'', are ignored. 2444b88c807SRodney W. Grimes.Sh EXAMPLES 2454b88c807SRodney W. Grimes.Bl -tag -width "u=rwx,go=u-w" -compact 2464b88c807SRodney W. Grimes.It Li 644 2474b88c807SRodney W. Grimesmake a file readable by anyone and writable by the owner only. 2484b88c807SRodney W. Grimes.Pp 2494b88c807SRodney W. Grimes.It Li go-w 2504b88c807SRodney W. Grimesdeny write permission to group and others. 2514b88c807SRodney W. Grimes.Pp 2524b88c807SRodney W. Grimes.It Li =rw,+X 2534b88c807SRodney W. Grimesset the read and write permissions to the usual defaults, but 2544b88c807SRodney W. Grimesretain any execute permissions that are currently set. 2554b88c807SRodney W. Grimes.Pp 2564b88c807SRodney W. Grimes.It Li +X 2574b88c807SRodney W. Grimesmake a directory or file searchable/executable by everyone if it is 2584b88c807SRodney W. Grimesalready searchable/executable by anyone. 2594b88c807SRodney W. Grimes.Pp 2604b88c807SRodney W. Grimes.It Li 755 2614b88c807SRodney W. Grimes.It Li u=rwx,go=rx 2624b88c807SRodney W. Grimes.It Li u=rwx,go=u-w 2634b88c807SRodney W. Grimesmake a file readable/executable by everyone and writable by the owner only. 2644b88c807SRodney W. Grimes.Pp 2654b88c807SRodney W. Grimes.It Li go= 2664b88c807SRodney W. Grimesclear all mode bits for group and others. 2674b88c807SRodney W. Grimes.Pp 2684b88c807SRodney W. Grimes.It Li g=u-w 2694b88c807SRodney W. Grimesset the group bits equal to the user bits, but clear the group write bit. 2704b88c807SRodney W. Grimes.El 2714b88c807SRodney W. Grimes.Sh BUGS 2724b88c807SRodney W. GrimesThere's no 2734b88c807SRodney W. Grimes.Ar perm 2744b88c807SRodney W. Grimesoption for the naughty bits. 2754b88c807SRodney W. Grimes.Sh SEE ALSO 2764b88c807SRodney W. Grimes.Xr install 1 , 2774b88c807SRodney W. Grimes.Xr chmod 2 , 2784b88c807SRodney W. Grimes.Xr stat 2 , 2794b88c807SRodney W. Grimes.Xr umask 2 , 2804b88c807SRodney W. Grimes.Xr fts 3 , 2814b88c807SRodney W. Grimes.Xr setmode 3 , 2824b88c807SRodney W. Grimes.Xr symlink 7 , 2834b88c807SRodney W. Grimes.Xr chown 8 2844b88c807SRodney W. Grimes.Sh STANDARDS 2854b88c807SRodney W. GrimesThe 2864b88c807SRodney W. Grimes.Nm chmod 2874b88c807SRodney W. Grimesutility is expected to be POSIX 1003.2 2884b88c807SRodney W. Grimescompatible with the exception of the 2894b88c807SRodney W. Grimes.Ar perm 2904b88c807SRodney W. Grimessymbols 2914b88c807SRodney W. Grimes.Dq t 2924b88c807SRodney W. Grimesand 2934b88c807SRodney W. Grimes.Dq X 2944b88c807SRodney W. Grimeswhich are not included in that standard. 295