Commit | Line | Data |
---|---|---|
d149e2aa KM |
1 | .\" Copyright (c) 1980 Regents of the University of California. |
2 | .\" All rights reserved. The Berkeley software License Agreement | |
3 | .\" specifies the terms and conditions for redistribution. | |
4 | .\" | |
5 | .\" @(#)chmod.2 4.1 (Berkeley) %G% | |
6 | .\" | |
7 | .TH CHMOD 2 | |
8 | .UC 4 | |
9 | .SH NAME | |
10 | chmod \- change mode of file | |
11 | .SH SYNOPSIS | |
12 | .nf | |
13 | .B chmod(name, mode) | |
14 | .B char *name; | |
15 | .fi | |
16 | .SH DESCRIPTION | |
17 | The file whose name | |
18 | is given as the null-terminated string pointed to by | |
19 | .I name | |
20 | has its mode changed to | |
21 | .IR mode . | |
22 | Modes are constructed by | |
23 | .IR or ing | |
24 | together some | |
25 | combination of the following: | |
26 | .PP | |
27 | .RS | |
28 | 04000 set user ID on execution | |
29 | 02000 set group ID on execution | |
30 | 01000 save text image after execution | |
31 | 00400 read by owner | |
32 | 00200 write by owner | |
33 | 00100 execute (search on directory) by owner | |
34 | 00070 read, write, execute (search) by group | |
35 | 00007 read, write, execute (search) by others | |
36 | .RE | |
37 | .PP | |
38 | If an executable file is set up for sharing (this is the default) | |
39 | then mode 1000 prevents the system from | |
40 | abandoning the swap-space image of the program-text portion | |
41 | of the file when its last user | |
42 | terminates. | |
43 | Ability to set this bit is restricted to the super-user | |
44 | since swap space is consumed | |
45 | by the images. | |
46 | See | |
47 | .IR sticky (8). | |
48 | .PP | |
49 | Only the owner of a file (or the super-user) may change the mode. | |
50 | Only the super-user can set the 1000 mode. | |
51 | .PP | |
52 | On some systems, | |
53 | writing or changing the owner of a file | |
54 | turns off the set-user-id bit. | |
55 | This makes the system somewhat more secure | |
56 | by protecting set-user-id files | |
57 | from remaining set-user-id if they are modified, | |
58 | at the expense of a degree of compatibility. | |
59 | .SH "SEE ALSO" | |
60 | chmod(1) | |
61 | .SH DIAGNOSTIC | |
62 | Zero is returned if the mode is changed; | |
63 | \-1 is returned if | |
64 | .I name | |
65 | cannot be found or if the current user | |
66 | is neither the owner of the file nor the super-user. | |
67 | .SH "ASSEMBLER (PDP-11)" | |
68 | (chmod = 15.) | |
69 | .br | |
70 | .B sys chmod; name; mode |