1CHMOD(1) General Commands Manual CHMOD(1)
2
3
4
6 chmod - change mode
7
9 chmod [ -Rf ] mode file ...
10
12 The mode of each named file is changed according to mode, which may be
13 absolute or symbolic. An absolute mode is an octal number constructed
14 from the OR of the following modes:
15
16 4000 set user ID on execution
17 2000 set group ID on execution
18 1000 sticky bit, see chmod(2)
19 0400 read by owner
20 0200 write by owner
21 0100 execute (search in directory) by owner
22 0070 read, write, execute (search) by group
23 0007 read, write, execute (search) by others
24
25 A symbolic mode has the form:
26
27 [who] op permission [op permission] ...
28
29 The who part is a combination of the letters u (for user's permis‐
30 sions), g (group) and o (other). The letter a stands for all, or ugo.
31 If who is omitted, the default is a but the setting of the file cre‐
32 ation mask (see umask(2)) is taken into account.
33
34 Op can be + to add permission to the file's mode, - to take away per‐
35 mission and = to assign permission absolutely (all other bits will be
36 reset).
37
38 Permission is any combination of the letters r (read), w (write), x
39 (execute), X (set execute only if file is a directory or some other
40 execute bit is set), s (set owner or group id) and t (save text -
41 sticky). Letters u, g, or o indicate that permission is to be taken
42 from the current mode. Omitting permission is only useful with = to
43 take away all permissions.
44
45 When the -R option is given, chmod recursively descends its directory
46 arguments setting the mode for each file as described above. When sym‐
47 bolic links are encountered, their mode is not changed and they are not
48 traversed.
49
50 If the -f option is given, chmod will not complain if it fails to
51 change the mode on a file.
52
54 The first example denies write permission to others, the second makes a
55 file executable by all if it is executable by anyone:
56
57 chmod o-w file
58 chmod +X file
59
60 Multiple symbolic modes separated by commas may be given. Operations
61 are performed in the order specified. The letter s is only useful with
62 u or g.
63
64 Only the owner of a file (or the super-user) may change its mode.
65
67 ls(1), chmod(2), stat(2), umask(2), chown(8)
68
69
70
717th Edition May 22, 1986 CHMOD(1)