Tizen 2.0 Release
[external/tizen-coreutils.git] / man / chmod.x
1 '\" Copyright (C) 1998, 1999, 2001, 2006 Free Software Foundation, Inc.
2 '\"
3 '\" This is free software.  You may redistribute copies of it under the terms
4 '\" of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
5 '\" There is NO WARRANTY, to the extent permitted by law.
6 [NAME]
7 chmod \- change file mode bits
8 [DESCRIPTION]
9 This manual page
10 documents the GNU version of
11 .BR chmod .
12 .B chmod
13 changes the file mode bits of each given file according to
14 .IR mode ,
15 which can be either a symbolic representation of changes to make, or
16 an octal number representing the bit pattern for the new mode bits.
17 .PP
18 The format of a symbolic mode is [\c
19 \fBugoa\fP.\|.\|.][[\fB+-=\fP][\fIperms\fP.\|.\|.].\|.\|.],
20 where
21 .I "perms"
22 is either zero or more letters from the set
23 \fBrwxXst\fP, or a single letter from the set \fBugo\fP.
24 Multiple symbolic
25 modes can be given, separated by commas.
26 .PP
27 A combination of the letters \fBugoa\fP controls which users' access
28 to the file will be changed: the user who owns it (\fBu\fP), other
29 users in the file's group (\fBg\fP), other users not in the file's
30 group (\fBo\fP), or all users (\fBa\fP).  If none of these are given,
31 the effect is as if \fBa\fP were
32 given, but bits that are set in the umask are not affected.
33 .PP
34 The operator \fB+\fP causes the selected file mode bits to be added to
35 the existing file mode bits of each file; \fB-\fP causes them to be
36 removed; and \fB=\fP causes them to be added and causes unmentioned
37 bits to be removed except that a directory's unmentioned set user and
38 group ID bits are not affected.
39 .PP
40 The letters \fBrwxXst\fP select file mode bits for the affected users:
41 read (\fBr\fP), write (\fBw\fP), execute (or search for directories)
42 (\fBx\fP), execute/search only if the file is a directory or already
43 has execute permission for some user (\fBX\fP), set user or group ID
44 on execution (\fBs\fP), restricted deletion flag or sticky bit
45 (\fBt\fP).  Instead of one or more of these letters, you can specify
46 exactly one of the letters \fBugo\fP: the permissions granted to the
47 user who owns the file (\fBu\fP), the permissions granted to other
48 users who are members of the file's group (\fBg\fP),
49 and the permissions granted to users that are in neither of the two preceding
50 categories (\fBo\fP).
51 .PP
52 A numeric mode is from one to four octal digits (0\-7), derived by
53 adding up the bits with values 4, 2, and 1.  Omitted digits are
54 assumed to be leading zeros, except that if the first digit is
55 omitted, a directory's set user and group ID bits are not affected.
56 The first digit selects the set user ID (4) and set group ID (2) and
57 restricted deletion or sticky (1) attributes.  The second digit
58 selects permissions for the user who owns the file: read (4), write (2),
59 and execute (1); the third selects permissions for other users in the
60 file's group, with the same values; and the fourth for other users not
61 in the file's group, with the same values.
62 .PP
63 .B chmod
64 never changes the permissions of symbolic links; the
65 .B chmod
66 system call cannot change their permissions.  This is not a problem
67 since the permissions of symbolic links are never used.
68 However, for each symbolic link listed on the command line,
69 .B chmod
70 changes the permissions of the pointed-to file.
71 In contrast,
72 .B chmod
73 ignores symbolic links encountered during recursive directory
74 traversals.
75 .SH "RESTRICTED DELETION FLAG OR STICKY BIT"
76 The restricted deletion flag or sticky bit is a single bit, whose
77 interpretation depends on the file type.  For directories, it prevents
78 unprivileged users from removing or renaming a file in the directory
79 unless they own the file or the directory; this is called the
80 .I "restricted deletion flag"
81 for the directory, and is commonly found on world-writable directories
82 like \fB/tmp\fP.  For regular files on some older systems, the bit
83 saves the program's text image on the swap device so it will load more
84 quickly when run; this is called the
85 .IR "sticky bit" .
86 .SH OPTIONS
87 [SEE ALSO]
88 chmod(2)