* man/chmod.x: Correct the description of the sticky bit. Reported
[platform/upstream/coreutils.git] / man / chmod.x
1 [NAME]
2 chmod \- change file access permissions
3 [DESCRIPTION]
4 This manual page
5 documents the GNU version of
6 .BR chmod .
7 .B chmod
8 changes the permissions of each given file according to
9 .IR mode ,
10 which can be either a symbolic representation of changes to make, or
11 an octal number representing the bit pattern for the new permissions.
12 .PP
13 The format of a symbolic mode is
14 `[ugoa...][[+-=][rwxXstugo...]...][,...]'.  Multiple symbolic
15 operations can be given, separated by commas.
16 .PP
17 A combination of the letters `ugoa' controls which users' access to
18 the file will be changed: the user who owns it (u), other users in the
19 file's group (g), other users not in the file's group (o), or all
20 users (a).  If none of these are given, the effect is as if `a' were
21 given, but bits that are set in the umask are not affected.
22 .PP
23 The operator `+' causes the permissions selected to be added to the
24 existing permissions of each file; `-' causes them to be removed; and
25 `=' causes them to be the only permissions that the file has.
26 .PP
27 The letters `rwxXstugo' select the new permissions for the affected
28 users: read (r), write (w), execute (or access for directories) (x),
29 execute only if the file is a directory or already has execute
30 permission for some user (X), set user or group ID on execution (s),
31 sticky (t), the permissions granted to the user who owns the file (u),
32 the permissions granted to other users who are members of the file's group (g),
33 and the permissions granted to users that are in neither of the two preceding
34 categories (o).
35 .PP
36 A numeric mode is from one to four octal digits (0-7), derived by
37 adding up the bits with values 4, 2, and 1.  Any omitted digits are
38 assumed to be leading zeros.  The first digit selects the set user ID
39 (4) and set group ID (2) and sticky (1) attributes.  The second digit
40 selects permissions for the user who owns the file: read (4), write (2),
41 and execute (1); the third selects permissions for other users in the
42 file's group, with the same values; and the fourth for other users not
43 in the file's group, with the same values.
44 .PP
45 .B chmod
46 never changes the permissions of symbolic links; the
47 .B chmod
48 system call cannot change their permissions.  This is not a problem
49 since the permissions of symbolic links are never used.
50 However, for each symbolic link listed on the command line,
51 .B chmod
52 changes the permissions of the pointed-to file.
53 In contrast,
54 .B chmod
55 ignores symbolic links encountered during recursive directory
56 traversals.
57 .SH STICKY FILES
58 On older Unix systems, the sticky bit caused executable files to be
59 hoarded in swap space.  This feature is not useful on modern VM
60 systems, and the Linux kernel ignores the sticky bit on files.  Other
61 kernels may use the sticky bit on files for system-defined purposes.
62 On some systems, only the superuser can set the sticky bit on files.
63 .SH STICKY DIRECTORIES
64 When the sticky bit is set on a directory, a file in that directory may
65 be unlinked or renamed only by the directory owner, the file owner, or root.
66 Without the sticky bit, anyone able to write to the
67 directory can delete or rename files.  The sticky bit is commonly found
68 on directories, such as /tmp, that are world-writable.
69 .SH OPTIONS
70 [SEE ALSO]
71 chmod(2)