HP-UX Reference (11i v1 05/09) - 1 User Commands A-M (vol 1)

c
chmod(1) chmod(1)
Numeric Mode (Obsolescent)
Absolute permissions can be set by specifying a numeric_mode, an octal number constructed from the logi-
cal OR (sum) of the following mode bits:
Miscellaneous mode bits:
4000 (= u=s) Set user ID on file execution (file only)
2000 (= g=s) Set group ID on file execution (file 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
-A Preserve any optional access control list (ACL) entries associated with the file (HFS file systems
only). By default, in conformance with the IEEE Standard POSIX 1003.1-1988, optional HFS
ACL entries are deleted. For JFS ACLs, this option has no effect, because optional JFS ACL
entries are always preserved. For information about access control lists, see acl(5) and aclv(5).
-R Recursively change the file mode bits. For each file operand that names a directory,
chmod
alters the file mode bits of the named directory and all files and subdirectories in the file hierar-
chy below it.
Only the owner of a file, 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 file.
If the sticky bit is set on a directory, files inside the directory may be renamed or removed only by the
owner of the file, the owner of the directory, or the superuser (even if the modes of the directory would oth-
erwise allow such an operation).
In order to set the set-group-ID bit, the group of the file must correspond to your current group ID.
If chmod is used on a symbolic link, the mode of the file 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 specified or is null, it defaults to the value of
LANG.IfLANG is not specified 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:
0 Successful completion.
>0 An error condition occurred.
EXAMPLES
Deny write permission to others:
chmod o-w file
Make a file executable by everybody:
HP-UX 11i Version 1: September 2005 2 Hewlett-Packard Company Section 185