Tizen 2.0 Release
[external/tizen-coreutils.git] / man / chmod.1
1 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.35.
2 .TH CHMOD "1" "March 2007" "GNU coreutils 6.9" "User Commands"
3 .SH NAME
4 chmod \- change file mode bits
5 .SH SYNOPSIS
6 .B chmod
7 [\fIOPTION\fR]... \fIMODE\fR[\fI,MODE\fR]... \fIFILE\fR...
8 .br
9 .B chmod
10 [\fIOPTION\fR]... \fIOCTAL-MODE FILE\fR...
11 .br
12 .B chmod
13 [\fIOPTION\fR]... \fI--reference=RFILE FILE\fR...
14 .SH DESCRIPTION
15 This manual page
16 documents the GNU version of
17 .BR chmod .
18 .B chmod
19 changes the file mode bits of each given file according to
20 .IR mode ,
21 which can be either a symbolic representation of changes to make, or
22 an octal number representing the bit pattern for the new mode bits.
23 .PP
24 The format of a symbolic mode is [\c
25 \fBugoa\fP.\|.\|.][[\fB+-=\fP][\fIperms\fP.\|.\|.].\|.\|.],
26 where
27 .I "perms"
28 is either zero or more letters from the set
29 \fBrwxXst\fP, or a single letter from the set \fBugo\fP.
30 Multiple symbolic
31 modes can be given, separated by commas.
32 .PP
33 A combination of the letters \fBugoa\fP controls which users' access
34 to the file will be changed: the user who owns it (\fBu\fP), other
35 users in the file's group (\fBg\fP), other users not in the file's
36 group (\fBo\fP), or all users (\fBa\fP).  If none of these are given,
37 the effect is as if \fBa\fP were
38 given, but bits that are set in the umask are not affected.
39 .PP
40 The operator \fB+\fP causes the selected file mode bits to be added to
41 the existing file mode bits of each file; \fB-\fP causes them to be
42 removed; and \fB=\fP causes them to be added and causes unmentioned
43 bits to be removed except that a directory's unmentioned set user and
44 group ID bits are not affected.
45 .PP
46 The letters \fBrwxXst\fP select file mode bits for the affected users:
47 read (\fBr\fP), write (\fBw\fP), execute (or search for directories)
48 (\fBx\fP), execute/search only if the file is a directory or already
49 has execute permission for some user (\fBX\fP), set user or group ID
50 on execution (\fBs\fP), restricted deletion flag or sticky bit
51 (\fBt\fP).  Instead of one or more of these letters, you can specify
52 exactly one of the letters \fBugo\fP: the permissions granted to the
53 user who owns the file (\fBu\fP), the permissions granted to other
54 users who are members of the file's group (\fBg\fP),
55 and the permissions granted to users that are in neither of the two preceding
56 categories (\fBo\fP).
57 .PP
58 A numeric mode is from one to four octal digits (0\-7), derived by
59 adding up the bits with values 4, 2, and 1.  Omitted digits are
60 assumed to be leading zeros, except that if the first digit is
61 omitted, a directory's set user and group ID bits are not affected.
62 The first digit selects the set user ID (4) and set group ID (2) and
63 restricted deletion or sticky (1) attributes.  The second digit
64 selects permissions for the user who owns the file: read (4), write (2),
65 and execute (1); the third selects permissions for other users in the
66 file's group, with the same values; and the fourth for other users not
67 in the file's group, with the same values.
68 .PP
69 .B chmod
70 never changes the permissions of symbolic links; the
71 .B chmod
72 system call cannot change their permissions.  This is not a problem
73 since the permissions of symbolic links are never used.
74 However, for each symbolic link listed on the command line,
75 .B chmod
76 changes the permissions of the pointed-to file.
77 In contrast,
78 .B chmod
79 ignores symbolic links encountered during recursive directory
80 traversals.
81 .SH "RESTRICTED DELETION FLAG OR STICKY BIT"
82 The restricted deletion flag or sticky bit is a single bit, whose
83 interpretation depends on the file type.  For directories, it prevents
84 unprivileged users from removing or renaming a file in the directory
85 unless they own the file or the directory; this is called the
86 .I "restricted deletion flag"
87 for the directory, and is commonly found on world-writable directories
88 like \fB/tmp\fP.  For regular files on some older systems, the bit
89 saves the program's text image on the swap device so it will load more
90 quickly when run; this is called the
91 .IR "sticky bit" .
92 .SH OPTIONS
93 .PP
94 Change the mode of each FILE to MODE.
95 .TP
96 \fB\-c\fR, \fB\-\-changes\fR
97 like verbose but report only when a change is made
98 .TP
99 \fB\-\-no\-preserve\-root\fR
100 do not treat `/' specially (the default)
101 .TP
102 \fB\-\-preserve\-root\fR
103 fail to operate recursively on `/'
104 .TP
105 \fB\-f\fR, \fB\-\-silent\fR, \fB\-\-quiet\fR
106 suppress most error messages
107 .TP
108 \fB\-v\fR, \fB\-\-verbose\fR
109 output a diagnostic for every file processed
110 .TP
111 \fB\-\-reference\fR=\fIRFILE\fR
112 use RFILE's mode instead of MODE values
113 .TP
114 \fB\-R\fR, \fB\-\-recursive\fR
115 change files and directories recursively
116 .TP
117 \fB\-\-help\fR
118 display this help and exit
119 .TP
120 \fB\-\-version\fR
121 output version information and exit
122 .PP
123 Each MODE is of the form `[ugoa]*([\-+=]([rwxXst]*|[ugo]))+'.
124 .SH AUTHOR
125 Written by David MacKenzie and Jim Meyering.
126 .SH "REPORTING BUGS"
127 Report bugs to <bug\-coreutils@gnu.org>.
128 .SH COPYRIGHT
129 Copyright \(co 2007 Free Software Foundation, Inc.
130 .br
131 This is free software.  You may redistribute copies of it under the terms of
132 the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
133 There is NO WARRANTY, to the extent permitted by law.
134 .SH "SEE ALSO"
135 chmod(2)
136 .PP
137 The full documentation for
138 .B chmod
139 is maintained as a Texinfo manual.  If the
140 .B info
141 and
142 .B chmod
143 programs are properly installed at your site, the command
144 .IP
145 .B info chmod
146 .PP
147 should give you access to the complete manual.