|
|
SUNWcsu
chmod changes or assigns the mode of a file. The mode of a file specifies its permissions and other attributes. The mode may be absolute or symbolic.
An absolute mode is specified using octal numbers:
where:
Enable mandatory locking if # is 6, 4, 2, or 0.
For directories, files are created with BSD semantics for propagation of the group ID. With this option, files and subdirectories created in the directory inherit the group ID of the directory, rather than of the current process. It may be cleared only by using symbolic mode.
Note that the
setgid
bit cannot be set (or cleared) in absolute
mode; it must be set (or cleared) in symbolic mode using
g+s
(or
g-s).
A symbolic mode specification has the following format:
where: <symbolic-mode-list> is a comma-separated list (with no intervening whitespace) of symbolic mode expressions of the form:
Operations are performed in the order given. Multiple permissions letters following a single operator cause the corresponding operations to be performed simultaneously.
If who is omitted, it defaults to a, but the setting of the file mode creation mask (see umask in sh.1 or csh.1 for more information) is taken into account. When who is omitted, chmod will not override the restrictions of your user mask.
If permissions is omitted, nothing is added.
If who is omitted, add the file mode bits represented by permissions, except for the those with corresponding bits in the file mode creation mask.
If who is present, add the file mode bits represented by the permissions.
If permissions is omitted, do nothing.
If who is omitted, clear the file mode bits represented by permissions, except for those with corresponding bits in the file mode creation mask.
If who is present, clear the file mode bits represented by permissions.
If who is omitted, clear all file mode bits; if who is present, clear the file mode bits represented by who.
If permissions is omitted, do nothing else.
If who is omitted, add the file mode bits represented by permissions, except for the those with corresponding bits in the file mode creation mask.
If who is present, add the file mode bits represented by permissions.
Permissions to a file may vary depending on your user identification number (UID) or group identification number (GID). Permissions are described in three sequences each having three characters:
User Group Other rwx rwx rwx
This example (user, group, and others all have permission to read, write, and execute a given file) demonstrates two categories for granting permissions: the access class and the permissions themselves.
The letter
s
is only meaningful
with
u
or
g,
and
t
only works
with
u.
Mandatory file and record locking (l) refers to a file's ability to have its reading or writing permissions locked while a program is accessing that file.
In a directory which has the set-group-ID bit set (reflected as either -----s--- or -----l--- in the output of 'ls -ld'), files and subdirectories are created with the group-ID of the parent directory--not that of current process.
It is not possible to permit group execution and enable a file to be locked on execution at the same time. In addition, it is not possible to turn on the set-group-ID bit and enable a file to be locked on execution at the same time. The following examples, therefore, are invalid and elicit error messages:
chmod g+x,+l file chmod g+s,+l file
Only the owner of a file or directory (or the super-user) may change that file's or directory's mode. Only the super-user may set the sticky bit on a non-directory file. If you are not super-user, chmod will mask the sticky-bit but will not return an error. In order to turn on a file's set-group-ID bit, your own group ID must correspond to the file's and group execution must be set.
Deny execute permission to everyone:
Allow only read permission to everyone:
Make a file readable and writable by the group and others:
example% chmod go+rw file example% chmod 066 file
Cause a file to be locked during access:
Allow everyone to read, write, and execute the file and turn on the set group-ID.
example% chmod a=rwx,g+s file example% chmod 2777 file
Absolute changes don't work for the set-group-ID bit of a directory. You must use g+s or g-s.
chmod permits you to produce useless modes so long as they are not illegal (for instance, making a text file executable). chmod does not check the file type to see if mandatory locking is meaningful.
If the filesystem is mounted with the nosuid option, setuid execution is not allowed.
|
|
Created by unroff & hp-tools. © by Hans-Peter Bischof. All Rights Reserved (1997).
Last modified 21/April/97