| 1 | Each file has a set of @dfn{permissions} that control the kinds of
|
|---|
| 2 | access that users have to that file. The permissions for a file are
|
|---|
| 3 | also called its @dfn{access mode}. They can be represented either in
|
|---|
| 4 | symbolic form or as an octal number.
|
|---|
| 5 |
|
|---|
| 6 | @menu
|
|---|
| 7 | * Mode Structure:: Structure of file permissions.
|
|---|
| 8 | * Symbolic Modes:: Mnemonic permissions representation.
|
|---|
| 9 | * Numeric Modes:: Permissions as octal numbers.
|
|---|
| 10 | @end menu
|
|---|
| 11 |
|
|---|
| 12 | @node Mode Structure
|
|---|
| 13 | @section Structure of File Permissions
|
|---|
| 14 |
|
|---|
| 15 | There are three kinds of permissions that a user can have for a file:
|
|---|
| 16 |
|
|---|
| 17 | @enumerate
|
|---|
| 18 | @item
|
|---|
| 19 | @cindex read permission
|
|---|
| 20 | permission to read the file. For directories, this means permission to
|
|---|
| 21 | list the contents of the directory.
|
|---|
| 22 | @item
|
|---|
| 23 | @cindex write permission
|
|---|
| 24 | permission to write to (change) the file. For directories, this means
|
|---|
| 25 | permission to create and remove files in the directory.
|
|---|
| 26 | @item
|
|---|
| 27 | @cindex execute permission
|
|---|
| 28 | permission to execute the file (run it as a program). For directories,
|
|---|
| 29 | this means permission to access files in the directory.
|
|---|
| 30 | @end enumerate
|
|---|
| 31 |
|
|---|
| 32 | There are three categories of users who may have different permissions
|
|---|
| 33 | to perform any of the above operations on a file:
|
|---|
| 34 |
|
|---|
| 35 | @enumerate
|
|---|
| 36 | @item
|
|---|
| 37 | the file's owner;
|
|---|
| 38 | @item
|
|---|
| 39 | other users who are in the file's group;
|
|---|
| 40 | @item
|
|---|
| 41 | everyone else.
|
|---|
| 42 | @end enumerate
|
|---|
| 43 |
|
|---|
| 44 | @cindex owner, default
|
|---|
| 45 | @cindex group owner, default
|
|---|
| 46 | Files are given an owner and group when they are created. Usually the
|
|---|
| 47 | owner is the current user and the group is the group of the directory
|
|---|
| 48 | the file is in, but this varies with the operating system, the
|
|---|
| 49 | file system the file is created on, and the way the file is created. You
|
|---|
| 50 | can change the owner and group of a file by using the @command{chown} and
|
|---|
| 51 | @command{chgrp} commands.
|
|---|
| 52 |
|
|---|
| 53 | In addition to the three sets of three permissions listed above, a
|
|---|
| 54 | file's permissions have three special components, which affect only
|
|---|
| 55 | executable files (programs) and, on some systems, directories:
|
|---|
| 56 |
|
|---|
| 57 | @enumerate
|
|---|
| 58 | @item
|
|---|
| 59 | @cindex setuid
|
|---|
| 60 | set the process's effective user ID to that of the file upon execution
|
|---|
| 61 | (called the @dfn{setuid bit}). No effect on directories.
|
|---|
| 62 | @item
|
|---|
| 63 | @cindex setgid
|
|---|
| 64 | set the process's effective group ID to that of the file upon execution
|
|---|
| 65 | (called the @dfn{setgid bit}). For directories on some systems, put
|
|---|
| 66 | files created in the directory into the same group as the directory, no
|
|---|
| 67 | matter what group the user who creates them is in.
|
|---|
| 68 | @item
|
|---|
| 69 | @cindex sticky
|
|---|
| 70 | @cindex swap space, saving text image in
|
|---|
| 71 | @cindex text image, saving in swap space
|
|---|
| 72 | @cindex restricted deletion flag
|
|---|
| 73 | prevent users from removing or renaming a file in a directory
|
|---|
| 74 | unless they own the file or the directory; this is called the
|
|---|
| 75 | @dfn{restricted deletion flag} for the directory.
|
|---|
| 76 | For regular files on some systems, save the program's text image on the
|
|---|
| 77 | swap device so it will load more quickly when run; this is called the
|
|---|
| 78 | @dfn{sticky bit}.
|
|---|
| 79 | @end enumerate
|
|---|
| 80 |
|
|---|
| 81 | In addition to the permissions listed above, there may be file attributes
|
|---|
| 82 | specific to the file system, e.g: access control lists (ACLs), whether a
|
|---|
| 83 | file is compressed, whether a file can be modified (immutability), whether
|
|---|
| 84 | a file can be dumped. These are usually set using programs
|
|---|
| 85 | specific to the file system. For example:
|
|---|
| 86 | @c should probably say a lot more about ACLs... someday
|
|---|
| 87 |
|
|---|
| 88 | @table @asis
|
|---|
| 89 | @item ext2
|
|---|
| 90 | On @acronym{GNU} and @acronym{GNU}/Linux the file permissions
|
|---|
| 91 | (``attributes'') specific to
|
|---|
| 92 | the ext2 file system are set using @command{chattr}.
|
|---|
| 93 |
|
|---|
| 94 | @item FFS
|
|---|
| 95 | On FreeBSD the file permissions (``flags'') specific to the FFS
|
|---|
| 96 | file system are set using @command{chrflags}.
|
|---|
| 97 | @end table
|
|---|
| 98 |
|
|---|
| 99 | Although a file's permission ``bits'' allow an operation on that file,
|
|---|
| 100 | that operation may still fail, because:
|
|---|
| 101 |
|
|---|
| 102 | @itemize
|
|---|
| 103 | @item
|
|---|
| 104 | the file-system-specific permissions do not permit it;
|
|---|
| 105 |
|
|---|
| 106 | @item
|
|---|
| 107 | the file system is mounted as read-only.
|
|---|
| 108 | @end itemize
|
|---|
| 109 |
|
|---|
| 110 | For example, if the immutable attribute is set on a file,
|
|---|
| 111 | it cannot be modified, regardless of the fact that you
|
|---|
| 112 | may have just run @code{chmod a+w FILE}.
|
|---|
| 113 |
|
|---|
| 114 | @node Symbolic Modes
|
|---|
| 115 | @section Symbolic Modes
|
|---|
| 116 |
|
|---|
| 117 | @cindex symbolic modes
|
|---|
| 118 | @dfn{Symbolic modes} represent changes to files' permissions as
|
|---|
| 119 | operations on single-character symbols. They allow you to modify either
|
|---|
| 120 | all or selected parts of files' permissions, optionally based on
|
|---|
| 121 | their previous values, and perhaps on the current @code{umask} as well
|
|---|
| 122 | (@pxref{Umask and Protection}).
|
|---|
| 123 |
|
|---|
| 124 | The format of symbolic modes is:
|
|---|
| 125 |
|
|---|
| 126 | @example
|
|---|
| 127 | @r{[}ugoa@dots{}@r{][}+-=@r{]}@var{perms}@dots{}@r{[},@dots{}@r{]}
|
|---|
| 128 | @end example
|
|---|
| 129 |
|
|---|
| 130 | @noindent
|
|---|
| 131 | where @var{perms} is either zero or more letters from the set
|
|---|
| 132 | @samp{rwxXst}, or a single letter from the set @samp{ugo}.
|
|---|
| 133 |
|
|---|
| 134 | The following sections describe the operators and other details of
|
|---|
| 135 | symbolic modes.
|
|---|
| 136 |
|
|---|
| 137 | @menu
|
|---|
| 138 | * Setting Permissions:: Basic operations on permissions.
|
|---|
| 139 | * Copying Permissions:: Copying existing permissions.
|
|---|
| 140 | * Changing Special Permissions:: Special permissions.
|
|---|
| 141 | * Conditional Executability:: Conditionally affecting executability.
|
|---|
| 142 | * Multiple Changes:: Making multiple changes.
|
|---|
| 143 | * Umask and Protection:: The effect of the umask.
|
|---|
| 144 | @end menu
|
|---|
| 145 |
|
|---|
| 146 | @node Setting Permissions
|
|---|
| 147 | @subsection Setting Permissions
|
|---|
| 148 |
|
|---|
| 149 | The basic symbolic operations on a file's permissions are adding,
|
|---|
| 150 | removing, and setting the permission that certain users have to read,
|
|---|
| 151 | write, and execute the file. These operations have the following
|
|---|
| 152 | format:
|
|---|
| 153 |
|
|---|
| 154 | @example
|
|---|
| 155 | @var{users} @var{operation} @var{permissions}
|
|---|
| 156 | @end example
|
|---|
| 157 |
|
|---|
| 158 | @noindent
|
|---|
| 159 | The spaces between the three parts above are shown for readability only;
|
|---|
| 160 | symbolic modes cannot contain spaces.
|
|---|
| 161 |
|
|---|
| 162 | The @var{users} part tells which users' access to the file is changed.
|
|---|
| 163 | It consists of one or more of the following letters (or it can be empty;
|
|---|
| 164 | @pxref{Umask and Protection}, for a description of what happens then). When
|
|---|
| 165 | more than one of these letters is given, the order that they are in does
|
|---|
| 166 | not matter.
|
|---|
| 167 |
|
|---|
| 168 | @table @code
|
|---|
| 169 | @item u
|
|---|
| 170 | @cindex owner of file, permissions for
|
|---|
| 171 | the user who owns the file;
|
|---|
| 172 | @item g
|
|---|
| 173 | @cindex group, permissions for
|
|---|
| 174 | other users who are in the file's group;
|
|---|
| 175 | @item o
|
|---|
| 176 | @cindex other permissions
|
|---|
| 177 | all other users;
|
|---|
| 178 | @item a
|
|---|
| 179 | all users; the same as @samp{ugo}.
|
|---|
| 180 | @end table
|
|---|
| 181 |
|
|---|
| 182 | The @var{operation} part tells how to change the affected users' access
|
|---|
| 183 | to the file, and is one of the following symbols:
|
|---|
| 184 |
|
|---|
| 185 | @table @code
|
|---|
| 186 | @item +
|
|---|
| 187 | @cindex adding permissions
|
|---|
| 188 | to add the @var{permissions} to whatever permissions the @var{users}
|
|---|
| 189 | already have for the file;
|
|---|
| 190 | @item -
|
|---|
| 191 | @cindex removing permissions
|
|---|
| 192 | @cindex subtracting permissions
|
|---|
| 193 | to remove the @var{permissions} from whatever permissions the
|
|---|
| 194 | @var{users} already have for the file;
|
|---|
| 195 | @item =
|
|---|
| 196 | @cindex setting permissions
|
|---|
| 197 | to make the @var{permissions} the only permissions that the @var{users}
|
|---|
| 198 | have for the file.
|
|---|
| 199 | @end table
|
|---|
| 200 |
|
|---|
| 201 | The @var{permissions} part tells what kind of access to the file should
|
|---|
| 202 | be changed; it is normally zero or more of the following letters. As with the
|
|---|
| 203 | @var{users} part, the order does not matter when more than one letter is
|
|---|
| 204 | given. Omitting the @var{permissions} part is useful only with the
|
|---|
| 205 | @samp{=} operation, where it gives the specified @var{users} no access
|
|---|
| 206 | at all to the file.
|
|---|
| 207 |
|
|---|
| 208 | @table @code
|
|---|
| 209 | @item r
|
|---|
| 210 | @cindex read permission, symbolic
|
|---|
| 211 | the permission the @var{users} have to read the file;
|
|---|
| 212 | @item w
|
|---|
| 213 | @cindex write permission, symbolic
|
|---|
| 214 | the permission the @var{users} have to write to the file;
|
|---|
| 215 | @item x
|
|---|
| 216 | @cindex execute permission, symbolic
|
|---|
| 217 | the permission the @var{users} have to execute the file.
|
|---|
| 218 | @end table
|
|---|
| 219 |
|
|---|
| 220 | For example, to give everyone permission to read and write a file,
|
|---|
| 221 | but not to execute it, use:
|
|---|
| 222 |
|
|---|
| 223 | @example
|
|---|
| 224 | a=rw
|
|---|
| 225 | @end example
|
|---|
| 226 |
|
|---|
| 227 | To remove write permission for from all users other than the file's
|
|---|
| 228 | owner, use:
|
|---|
| 229 |
|
|---|
| 230 | @example
|
|---|
| 231 | go-w
|
|---|
| 232 | @end example
|
|---|
| 233 |
|
|---|
| 234 | @noindent
|
|---|
| 235 | The above command does not affect the access that the owner of
|
|---|
| 236 | the file has to it, nor does it affect whether other users can
|
|---|
| 237 | read or execute the file.
|
|---|
| 238 |
|
|---|
| 239 | To give everyone except a file's owner no permission to do anything with
|
|---|
| 240 | that file, use the mode below. Other users could still remove the file,
|
|---|
| 241 | if they have write permission on the directory it is in.
|
|---|
| 242 |
|
|---|
| 243 | @example
|
|---|
| 244 | go=
|
|---|
| 245 | @end example
|
|---|
| 246 |
|
|---|
| 247 | @noindent
|
|---|
| 248 | Another way to specify the same thing is:
|
|---|
| 249 |
|
|---|
| 250 | @example
|
|---|
| 251 | og-rwx
|
|---|
| 252 | @end example
|
|---|
| 253 |
|
|---|
| 254 | @node Copying Permissions
|
|---|
| 255 | @subsection Copying Existing Permissions
|
|---|
| 256 |
|
|---|
| 257 | @cindex copying existing permissions
|
|---|
| 258 | @cindex permissions, copying existing
|
|---|
| 259 | You can base a file's permissions on its existing permissions. To do
|
|---|
| 260 | this, instead of using a series of @samp{r}, @samp{w}, or @samp{x}
|
|---|
| 261 | letters after the
|
|---|
| 262 | operator, you use the letter @samp{u}, @samp{g}, or @samp{o}. For
|
|---|
| 263 | example, the mode
|
|---|
| 264 |
|
|---|
| 265 | @example
|
|---|
| 266 | o+g
|
|---|
| 267 | @end example
|
|---|
| 268 |
|
|---|
| 269 | @noindent
|
|---|
| 270 | adds the permissions for users who are in a file's group to the
|
|---|
| 271 | permissions that other users have for the file. Thus, if the file
|
|---|
| 272 | started out as mode 664 (@samp{rw-rw-r--}), the above mode would change
|
|---|
| 273 | it to mode 666 (@samp{rw-rw-rw-}). If the file had started out as mode
|
|---|
| 274 | 741 (@samp{rwxr----x}), the above mode would change it to mode 745
|
|---|
| 275 | (@samp{rwxr--r-x}). The @samp{-} and @samp{=} operations work
|
|---|
| 276 | analogously.
|
|---|
| 277 |
|
|---|
| 278 | @node Changing Special Permissions
|
|---|
| 279 | @subsection Changing Special Permissions
|
|---|
| 280 |
|
|---|
| 281 | @cindex changing special permissions
|
|---|
| 282 | In addition to changing a file's read, write, and execute permissions,
|
|---|
| 283 | you can change its special permissions. @xref{Mode Structure}, for a
|
|---|
| 284 | summary of these permissions.
|
|---|
| 285 |
|
|---|
| 286 | To change a file's permission to set the user ID on execution, use
|
|---|
| 287 | @samp{u} in the @var{users} part of the symbolic mode and
|
|---|
| 288 | @samp{s} in the @var{permissions} part.
|
|---|
| 289 |
|
|---|
| 290 | To change a file's permission to set the group ID on execution, use
|
|---|
| 291 | @samp{g} in the @var{users} part of the symbolic mode and
|
|---|
| 292 | @samp{s} in the @var{permissions} part.
|
|---|
| 293 |
|
|---|
| 294 | To change a file's permission to set the restricted deletion flag or sticky bit,
|
|---|
| 295 | omit the @var{users} part of the symbolic mode (or use @samp{a}) and put
|
|---|
| 296 | @samp{t} in the @var{permissions} part.
|
|---|
| 297 |
|
|---|
| 298 | For example, to add set-user-ID permission to a program,
|
|---|
| 299 | you can use the mode:
|
|---|
| 300 |
|
|---|
| 301 | @example
|
|---|
| 302 | u+s
|
|---|
| 303 | @end example
|
|---|
| 304 |
|
|---|
| 305 | To remove both set-user-ID and set-group-ID permission from
|
|---|
| 306 | it, you can use the mode:
|
|---|
| 307 |
|
|---|
| 308 | @example
|
|---|
| 309 | ug-s
|
|---|
| 310 | @end example
|
|---|
| 311 |
|
|---|
| 312 | To set the restricted deletion flag or sticky bit, you can use
|
|---|
| 313 | the mode:
|
|---|
| 314 |
|
|---|
| 315 | @example
|
|---|
| 316 | +t
|
|---|
| 317 | @end example
|
|---|
| 318 |
|
|---|
| 319 | The combination @samp{o+s} has no effect. On @acronym{GNU} systems
|
|---|
| 320 | the combinations @samp{u+t} and @samp{g+t} have no effect, and
|
|---|
| 321 | @samp{o+t} acts like plain @samp{+t}.
|
|---|
| 322 |
|
|---|
| 323 | The @samp{=} operator is not very useful with special permissions; for
|
|---|
| 324 | example, the mode:
|
|---|
| 325 |
|
|---|
| 326 | @example
|
|---|
| 327 | o=t
|
|---|
| 328 | @end example
|
|---|
| 329 |
|
|---|
| 330 | @noindent
|
|---|
| 331 | does set the restricted deletion flag or sticky bit, but it also
|
|---|
| 332 | removes all read, write, and execute permissions that users not in the
|
|---|
| 333 | file's group might have had for it.
|
|---|
| 334 |
|
|---|
| 335 | @node Conditional Executability
|
|---|
| 336 | @subsection Conditional Executability
|
|---|
| 337 |
|
|---|
| 338 | @cindex conditional executability
|
|---|
| 339 | There is one more special type of symbolic permission: if you use
|
|---|
| 340 | @samp{X} instead of @samp{x}, execute permission is affected only if the
|
|---|
| 341 | file is a directory or already had execute permission.
|
|---|
| 342 |
|
|---|
| 343 | For example, this mode:
|
|---|
| 344 |
|
|---|
| 345 | @example
|
|---|
| 346 | a+X
|
|---|
| 347 | @end example
|
|---|
| 348 |
|
|---|
| 349 | @noindent
|
|---|
| 350 | gives all users permission to search directories, or to execute files if
|
|---|
| 351 | anyone could execute them before.
|
|---|
| 352 |
|
|---|
| 353 | @node Multiple Changes
|
|---|
| 354 | @subsection Making Multiple Changes
|
|---|
| 355 |
|
|---|
| 356 | @cindex multiple changes to permissions
|
|---|
| 357 | The format of symbolic modes is actually more complex than described
|
|---|
| 358 | above (@pxref{Setting Permissions}). It provides two ways to make
|
|---|
| 359 | multiple changes to files' permissions.
|
|---|
| 360 |
|
|---|
| 361 | The first way is to specify multiple @var{operation} and
|
|---|
| 362 | @var{permissions} parts after a @var{users} part in the symbolic mode.
|
|---|
| 363 |
|
|---|
| 364 | For example, the mode:
|
|---|
| 365 |
|
|---|
| 366 | @example
|
|---|
| 367 | og+rX-w
|
|---|
| 368 | @end example
|
|---|
| 369 |
|
|---|
| 370 | @noindent
|
|---|
| 371 | gives users other than the owner of the file read permission and, if
|
|---|
| 372 | it is a directory or if someone already had execute permission
|
|---|
| 373 | to it, gives them execute permission; and it also denies them write
|
|---|
| 374 | permission to the file. It does not affect the permission that the
|
|---|
| 375 | owner of the file has for it. The above mode is equivalent to
|
|---|
| 376 | the two modes:
|
|---|
| 377 |
|
|---|
| 378 | @example
|
|---|
| 379 | og+rX
|
|---|
| 380 | og-w
|
|---|
| 381 | @end example
|
|---|
| 382 |
|
|---|
| 383 | The second way to make multiple changes is to specify more than one
|
|---|
| 384 | simple symbolic mode, separated by commas. For example, the mode:
|
|---|
| 385 |
|
|---|
| 386 | @example
|
|---|
| 387 | a+r,go-w
|
|---|
| 388 | @end example
|
|---|
| 389 |
|
|---|
| 390 | @noindent
|
|---|
| 391 | gives everyone permission to read the file and removes write
|
|---|
| 392 | permission on it for all users except its owner. Another example:
|
|---|
| 393 |
|
|---|
| 394 | @example
|
|---|
| 395 | u=rwx,g=rx,o=
|
|---|
| 396 | @end example
|
|---|
| 397 |
|
|---|
| 398 | @noindent
|
|---|
| 399 | sets all of the non-special permissions for the file explicitly. (It
|
|---|
| 400 | gives users who are not in the file's group no permission at all for
|
|---|
| 401 | it.)
|
|---|
| 402 |
|
|---|
| 403 | The two methods can be combined. The mode:
|
|---|
| 404 |
|
|---|
| 405 | @example
|
|---|
| 406 | a+r,g+x-w
|
|---|
| 407 | @end example
|
|---|
| 408 |
|
|---|
| 409 | @noindent
|
|---|
| 410 | gives all users permission to read the file, and gives users who are in
|
|---|
| 411 | the file's group permission to execute it, as well, but not permission
|
|---|
| 412 | to write to it. The above mode could be written in several different
|
|---|
| 413 | ways; another is:
|
|---|
| 414 |
|
|---|
| 415 | @example
|
|---|
| 416 | u+r,g+rx,o+r,g-w
|
|---|
| 417 | @end example
|
|---|
| 418 |
|
|---|
| 419 | @node Umask and Protection
|
|---|
| 420 | @subsection The Umask and Protection
|
|---|
| 421 |
|
|---|
| 422 | @cindex umask and modes
|
|---|
| 423 | @cindex modes and umask
|
|---|
| 424 | If the @var{users} part of a symbolic mode is omitted, it defaults to
|
|---|
| 425 | @samp{a} (affect all users), except that any permissions that are
|
|---|
| 426 | @emph{set} in the system variable @code{umask} are @emph{not affected}.
|
|---|
| 427 | The value of @code{umask} can be set using the
|
|---|
| 428 | @code{umask} command. Its default value varies from system to system.
|
|---|
| 429 |
|
|---|
| 430 | @cindex giving away permissions
|
|---|
| 431 | Omitting the @var{users} part of a symbolic mode is generally not useful
|
|---|
| 432 | with operations other than @samp{+}. It is useful with @samp{+} because
|
|---|
| 433 | it allows you to use @code{umask} as an easily customizable protection
|
|---|
| 434 | against giving away more permission to files than you intended to.
|
|---|
| 435 |
|
|---|
| 436 | As an example, if @code{umask} has the value 2, which removes write
|
|---|
| 437 | permission for users who are not in the file's group, then the mode:
|
|---|
| 438 |
|
|---|
| 439 | @example
|
|---|
| 440 | +w
|
|---|
| 441 | @end example
|
|---|
| 442 |
|
|---|
| 443 | @noindent
|
|---|
| 444 | adds permission to write to the file to its owner and to other users who
|
|---|
| 445 | are in the file's group, but @emph{not} to other users. In contrast,
|
|---|
| 446 | the mode:
|
|---|
| 447 |
|
|---|
| 448 | @example
|
|---|
| 449 | a+w
|
|---|
| 450 | @end example
|
|---|
| 451 |
|
|---|
| 452 | @noindent
|
|---|
| 453 | ignores @code{umask}, and @emph{does} give write permission for
|
|---|
| 454 | the file to all users.
|
|---|
| 455 |
|
|---|
| 456 | @node Numeric Modes
|
|---|
| 457 | @section Numeric Modes
|
|---|
| 458 |
|
|---|
| 459 | @cindex numeric modes
|
|---|
| 460 | @cindex file permissions, numeric
|
|---|
| 461 | @cindex octal numbers for file modes
|
|---|
| 462 | As an
|
|---|
| 463 | alternative to giving a symbolic mode, you can give an octal (base 8)
|
|---|
| 464 | number that represents the new mode.
|
|---|
| 465 | This number is always interpreted in octal; you do not have to add a
|
|---|
| 466 | leading 0, as you do in C. Mode 0055 is the same as mode 55.
|
|---|
| 467 |
|
|---|
| 468 | A numeric mode is usually shorter than the corresponding symbolic
|
|---|
| 469 | mode, but it is limited in that it cannot take into account a file's
|
|---|
| 470 | previous permissions; it can only set them absolutely.
|
|---|
| 471 |
|
|---|
| 472 | The permissions granted to the user,
|
|---|
| 473 | to other users in the file's group,
|
|---|
| 474 | and to other users not in the file's group each require three
|
|---|
| 475 | bits, which are represented as one octal digit. The three special
|
|---|
| 476 | permissions also require one bit each, and they are as a group
|
|---|
| 477 | represented as another octal digit. Here is how the bits are arranged,
|
|---|
| 478 | starting with the lowest valued bit:
|
|---|
| 479 |
|
|---|
| 480 | @example
|
|---|
| 481 | Value in Corresponding
|
|---|
| 482 | Mode Permission
|
|---|
| 483 |
|
|---|
| 484 | Other users not in the file's group:
|
|---|
| 485 | 1 Execute
|
|---|
| 486 | 2 Write
|
|---|
| 487 | 4 Read
|
|---|
| 488 |
|
|---|
| 489 | Other users in the file's group:
|
|---|
| 490 | 10 Execute
|
|---|
| 491 | 20 Write
|
|---|
| 492 | 40 Read
|
|---|
| 493 |
|
|---|
| 494 | The file's owner:
|
|---|
| 495 | 100 Execute
|
|---|
| 496 | 200 Write
|
|---|
| 497 | 400 Read
|
|---|
| 498 |
|
|---|
| 499 | Special permissions:
|
|---|
| 500 | 1000 Restricted deletion flag or sticky bit
|
|---|
| 501 | 2000 Set group ID on execution
|
|---|
| 502 | 4000 Set user ID on execution
|
|---|
| 503 | @end example
|
|---|
| 504 |
|
|---|
| 505 | For example, numeric mode 4755 corresponds to symbolic mode
|
|---|
| 506 | @samp{u=rwxs,go=rx}, and numeric mode 664 corresponds to symbolic mode
|
|---|
| 507 | @samp{ug=rw,o=r}. Numeric mode 0 corresponds to symbolic mode
|
|---|
| 508 | @samp{a=}.
|
|---|