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

-APreserve any optional access control list (ACL) entries associated with the ®le (HFS ®le 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).

-RRecursively change the ®le mode bits. For each ®le operand that names a directory, chmod alters the ®le mode bits of the named directory and all ®les and subdirectories in the ®le hierarchy below it.

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 set-group-ID bit, the group of the ®le must correspond to your current group ID.

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 o-w ®le

Make a ®le executable by everybody:

HP-UX Release 11i: December 2000

− 2 −

Section 185

c