chmod(1) | chmod(1) |
Numeric Mode (Obsolescent)
Absolute permissions can be set by specifying a numeric_mode, an octal number constructed from the logical OR (sum) of the following mode bits:
Miscellaneous mode bits:
4000 | (= u=s) | Set user ID on ®le execution (®le only) | |
2000 | (= | g=s) | Set group ID on ®le execution (®le only) |
1000 | (= | u=t) | Set sticky bit; see below and chmod(2) |
Permission mode bits:
0400 | (= u=r) | Read by owner |
0200 | (= u=w) | Write by owner |
0100 | (= u=x) | Execute (search in directory) by owner |
0040 | (= g=r) | Read by group |
0020 | (= g=w) | Write by group |
0010 | (= g=x) | Execute/search by group |
0004 | (= o=r) | Read by others |
0002 | (= o=w) | Write by others |
0001 | (= o=x) | Execute/search by others |
Options
Only the owner of a ®le, or a user with appropriate privileges, can change its mode.
Only a user having appropriate privileges can set (or retain, if previously set) the sticky bit of a regular ®le.
If the sticky bit is set on a directory, ®les inside the directory may be renamed or removed only by the owner of the ®le, the owner of the directory, or the superuser (even if the modes of the directory would otherwise allow such an operation).
In order to set the
If chmod is used on a symbolic link, the mode of the ®le referred to by the link is changed.
EXTERNAL INFLUENCES
Environment Variables
LC_MESSAGES determines the language in which messages are displayed.
If LC_MESSAGES is not speci®ed or is null, it defaults to the value of LANG. If LANG is not speci®ed or is null, it defaults to C (see lang(5)).
If any internationalization variable contains an invalid setting, all internationalization variables default to C. See environ(5).
International Code Set Support
Single- and multibyte character code sets are supported.
RETURN VALUE
Upon completion, chmod returns one of the following values:
0Successful completion.
>0 An error condition occurred.
EXAMPLES
Deny write permission to others:
chmod
Make a ®le executable by everybody:
− 2 − | Section 1−85 |
c