[9] | 1 | .TH CHMOD 1
|
---|
| 2 | .SH NAME
|
---|
| 3 | chmod \- change access mode for files
|
---|
| 4 | .SH SYNOPSIS
|
---|
| 5 | \fBchmod [\fB\-R\fR] \fImode \fIfile\fR ...\fR
|
---|
| 6 | .br
|
---|
| 7 | .de FL
|
---|
| 8 | .TP
|
---|
| 9 | \\fB\\$1\\fR
|
---|
| 10 | \\$2
|
---|
| 11 | ..
|
---|
| 12 | .de EX
|
---|
| 13 | .TP 20
|
---|
| 14 | \\fB\\$1\\fR
|
---|
| 15 | # \\$2
|
---|
| 16 | ..
|
---|
| 17 | .SH OPTIONS
|
---|
| 18 | .FL "\-R" "Change hierarchies recursively"
|
---|
| 19 | .SH EXAMPLES
|
---|
| 20 | .EX "chmod 755 file" "Owner: rwx Group: r\-x Others: r\-x"
|
---|
| 21 | .EX "chmod +x file1 file2" "Make \fIfile1\fR and \fIfile2\fR executable"
|
---|
| 22 | .EX "chmod a\-w file" "Make \fIfile\fR read only"
|
---|
| 23 | .EX "chmod u+s file" "Turn on SETUID for \fIfile\fR"
|
---|
| 24 | .EX "chmod \-R o+w dir" "Allow writing for all files in dir"
|
---|
| 25 | .SH DESCRIPTION
|
---|
| 26 | .PP
|
---|
| 27 | The given mode is applied to each file in the file list. If the \fB\-R\fR
|
---|
| 28 | flag is present, the files in a directory will be changed as well.
|
---|
| 29 | The mode can be either absolute or symbolic. Absolute modes are given as an
|
---|
| 30 | octal number that represents the new file mode. The mode bits are defined as
|
---|
| 31 | follows:
|
---|
| 32 | .ta 0.25i
|
---|
| 33 | .nf
|
---|
| 34 | .PP
|
---|
| 35 | 4000 Set effective user id on execution to file's owner id
|
---|
| 36 | 2000 Set effective group id on execution to file's group id
|
---|
| 37 | 0400 file is readable by the owner of the file
|
---|
| 38 | 0200 writeable by owner
|
---|
| 39 | 0100 executable by owner
|
---|
| 40 | 0070 same as above, for other users in the same group
|
---|
| 41 | 0007 same as above, for all other users
|
---|
| 42 | .PP
|
---|
| 43 | .fi
|
---|
| 44 | Symbolic modes modify the current file mode in a specified way. The form is:
|
---|
| 45 | .PP
|
---|
| 46 | [who] op permissions { op permissions ...} {, [who] op ... }
|
---|
| 47 | .PP
|
---|
| 48 | The possibilities for \fIwho\fR are \fIu\fR, \fIg\fR, \fIo\fR, and \fIa\fR,
|
---|
| 49 | standing for user, group, other and all, respectively.
|
---|
| 50 | If \fIwho\fR is omitted, \fIa\fR is assumed, but the current umask is used.
|
---|
| 51 | The op can be \fI+\fR, \fI-\fR, or \fI=\fR; \fI+\fR turns on the
|
---|
| 52 | given permissions, \fI\- \fRturns them off; \fI=\fR sets the permissions
|
---|
| 53 | exclusively for the given \fIwho\fR.
|
---|
| 54 | For example \fIg=x\fR sets the group permissions to \fI--x\fR.
|
---|
| 55 | .PP
|
---|
| 56 | The possible permissions are \fIr\fR, \fIw\fR, \fIx\fR; which stand for read,
|
---|
| 57 | write, and execute; \fIs\fR turns on the set effective user/group id bits.
|
---|
| 58 | \fIs\fR only makes sense with \fIu\fR and \fIg\fR;\fR o+s\fR is
|
---|
| 59 | harmless.
|
---|
| 60 | .SH "SEE ALSO"
|
---|
| 61 | .BR ls (1),
|
---|
| 62 | .BR chmod (2).
|
---|