HP-UX Reference (11i v1 05/09) - 1 User Commands A-M (vol 1)
c
chmod(1) chmod(1)
NAME
chmod - change file mode access permissions
SYNOPSIS
/usr/bin/chmod
[-A][-R] symbolic_mode_list file ...
Obsolescent form:
/usr/bin/chmod
[-A][-R] numeric_mode file ...
DESCRIPTION
The
chmod command changes the permissions of one or more files according to the value of
symbolic_mode_list or numeric_mode. You can display the current permissions for a file with the
ls -l
command (see ls(1)).
Symbolic Mode List
A symbolic_mode_list is a comma-separated list of operations in the following form. Whitespace is not per-
mitted.
[who]op[permission][
,...]
The variable fields can have the following values:
who One or more of the following letters:
u Modify permissions for user (owner).
g Modify permissions for group.
o Modify permissions for others.
a Modify permissions for all users (a is equivalent to ugo).
op Required; one of the following symbols:
+ Add permission to the existing file mode bits of who.
- Delete permission from the existing file mode bits of who.
= Replace the existing mode bits of who with permission.
permission One or more of the following letters:
r Add or delete the read permission for who.
w Add or delete the write permission for who.
x Add or delete the execute file (search directory) permission for who.
s Add or delete the set-owner-ID-on-file-execution or set-group-ID-on-file-
execution permission for who. Useful only if u or g is expressed or implied in
who.
t Add or delete the save-text-image-on-file-execution (sticky bit) permission.
Useful only if u is expressed or implied in who. See chmod(2).
X Conditionally add or delete the execute/search permission as follows:
• If file is a directory, add or delete the search permission to the existing file
mode for who. (Same as x.)
• If file is not a directory, and the current file permissions include the execute
permission (ls -l displays an x or an s) for at least one of user, group, or
other, then add or delete the execute file permission for who.
• If file is not a directory, and no execute permissions are set in the current
file mode, then do not change any execute permission.
Or one only of the following letters:
u Copy the current user permissions to who.
g Copy the current group permissions to who.
o Copy the current other permissions to who.
The operations are performed in the order specified, and can override preceding operations specified in the
same command line.
If who is omitted, the r, w, x, and X permissions are changed for all users if the changes are permitted by
the current file mode creation mask (see umask(1)). The s and t permissions are changed as if a was
specified in who.
Omitting permission is useful only when used with = to delete all permissions.
Section 1−−84 Hewlett-Packard Company − 1 − HP-UX 11i Version 1: September 2005