chmod

QNX SDP8.0Utilities ReferenceUtilities

Change file modes (POSIX, toybox)

Syntax:

chmod [-R] mode file...

Runs on:

QNX OS

Options:

-R
Recursively change file modes. For each file that names a directory, chmod changes the file mode bits of the directory and all files in the file hierarchy below it.
mode
Represents the change to be made to the file mode of each file named (see the description below).
file
The pathname of a file whose file mode bits are to be modified.

Description:

The chmod utility lets you change the file permission mode bits of the listed files. For each file that you name, chmod changes the file permission mode bits according to the mode operand.

The mode option can either be a symbolic_mode expression or a nonnegative octal value up to 7777.

Symbolic Modes

Symbolic modes have the following form:
[who]operator[permissions]
The who controls which users' access to the file will be changed (default is a if no category is specified). It can be any combination of:
a
User, group, and other access.
g
Group access.
o
Other access.
u
User access.
The above categories are then followed by an operator:
+
Set the specified permissions to the group, other, or user category of the specified files.
-
Clear specified permissions from the group, other, or user category of the specified files.
=
Copy the specified permissions for the group, other, or user category of the specified files.
The specified operator is then followed by any combination of permissions:
r
Read permission.
s
When executed, set the user ID (if u is implied) and/or group ID (if g is implied).
t
Sticky bit; can't delete files you don't own out of this directory.
w
Write permission.
X
Execute and search permission if the file is a directory or at least one execute bit is on before any of the file mode bits are modified.
x
Execute permission.

This utility is provided as part of the toybox package. For information on how to enable it, see toybox.

Examples:

Allow owner of a file to write to it:

chmod u+w file

User can read, write and execute to the file (everyone else can only read):

chmod 744 file

Contributing author:

Rob Landley and the toybox project (see https://landley.net/toybox/).

Page updated: