OSDN Git Service

Update translations: chroot, csplit, dd, du, pwd
[linuxjm/coreutils.git] / original / man1 / chmod.1
1 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.47.3.
2 .TH CHMOD "1" "January 2016" "GNU coreutils 8.25" "User Commands"
3 .SH NAME
4 chmod \- change file mode bits
5 .SH SYNOPSIS
6 .B chmod
7 [\fI\,OPTION\/\fR]... \fI\,MODE\/\fR[\fI\,,MODE\/\fR]... \fI\,FILE\/\fR...
8 .br
9 .B chmod
10 [\fI\,OPTION\/\fR]... \fI\,OCTAL-MODE FILE\/\fR...
11 .br
12 .B chmod
13 [\fI\,OPTION\/\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.
61 The first digit selects the set user ID (4) and set group ID (2) and
62 restricted deletion or sticky (1) attributes.  The second digit
63 selects permissions for the user who owns the file: read (4), write (2),
64 and execute (1); the third selects permissions for other users in the
65 file's group, with the same values; and the fourth for other users not
66 in the file's group, with the same values.
67 .PP
68 .B chmod
69 never changes the permissions of symbolic links; the
70 .B chmod
71 system call cannot change their permissions.  This is not a problem
72 since the permissions of symbolic links are never used.
73 However, for each symbolic link listed on the command line,
74 .B chmod
75 changes the permissions of the pointed-to file.
76 In contrast,
77 .B chmod
78 ignores symbolic links encountered during recursive directory
79 traversals.
80 .SH "SETUID AND SETGID BITS"
81 .B chmod
82 clears the set-group-ID bit of a
83 regular file if the file's group ID does not match the user's
84 effective group ID or one of the user's supplementary group IDs,
85 unless the user has appropriate privileges.  Additional restrictions
86 may cause the set-user-ID and set-group-ID bits of
87 .I MODE
88 or
89 .I RFILE
90 to be ignored.  This behavior depends on the policy and
91 functionality of the underlying
92 .B chmod
93 system call.  When in
94 doubt, check the underlying system behavior.
95 .PP
96 .B chmod
97 preserves a directory's set-user-ID and set-group-ID bits unless you
98 explicitly specify otherwise.  You can set or clear the bits with
99 symbolic modes like
100 .B u+s
101 and
102 .BR g\-s ,
103 and you can set (but not clear) the bits with a numeric mode.
104 .SH "RESTRICTED DELETION FLAG OR STICKY BIT"
105 The restricted deletion flag or sticky bit is a single bit, whose
106 interpretation depends on the file type.  For directories, it prevents
107 unprivileged users from removing or renaming a file in the directory
108 unless they own the file or the directory; this is called the
109 .I "restricted deletion flag"
110 for the directory, and is commonly found on world-writable directories
111 like \fB/tmp\fP.  For regular files on some older systems, the bit
112 saves the program's text image on the swap device so it will load more
113 quickly when run; this is called the
114 .IR "sticky bit" .
115 .SH OPTIONS
116 .PP
117 Change the mode of each FILE to MODE.
118 With \fB\-\-reference\fR, change the mode of each FILE to that of RFILE.
119 .TP
120 \fB\-c\fR, \fB\-\-changes\fR
121 like verbose but report only when a change is made
122 .TP
123 \fB\-f\fR, \fB\-\-silent\fR, \fB\-\-quiet\fR
124 suppress most error messages
125 .TP
126 \fB\-v\fR, \fB\-\-verbose\fR
127 output a diagnostic for every file processed
128 .TP
129 \fB\-\-no\-preserve\-root\fR
130 do not treat '/' specially (the default)
131 .TP
132 \fB\-\-preserve\-root\fR
133 fail to operate recursively on '/'
134 .TP
135 \fB\-\-reference\fR=\fI\,RFILE\/\fR
136 use RFILE's mode instead of MODE values
137 .TP
138 \fB\-R\fR, \fB\-\-recursive\fR
139 change files and directories recursively
140 .TP
141 \fB\-\-help\fR
142 display this help and exit
143 .TP
144 \fB\-\-version\fR
145 output version information and exit
146 .PP
147 Each MODE is of the form '[ugoa]*([\-+=]([rwxXst]*|[ugo]))+|[\-+=][0\-7]+'.
148 .SH AUTHOR
149 Written by David MacKenzie and Jim Meyering.
150 .SH "REPORTING BUGS"
151 GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
152 .br
153 Report chmod translation bugs to <http://translationproject.org/team/>
154 .SH COPYRIGHT
155 Copyright \(co 2016 Free Software Foundation, Inc.
156 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
157 .br
158 This is free software: you are free to change and redistribute it.
159 There is NO WARRANTY, to the extent permitted by law.
160 .SH "SEE ALSO"
161 chmod(2)
162 .PP
163 .br
164 Full documentation at: <http://www.gnu.org/software/coreutils/chmod>
165 .br
166 or available locally via: info \(aq(coreutils) chmod invocation\(aq