CHMOD(1) FSF CHMOD(1)
NAME
chmod(1,2) - change file(1,n) access(2,5) permissions
SYNOPSIS
chmod(1,2) [OPTION]... MODE[,MODE]... FILE...
chmod(1,2) [OPTION]... OCTAL-MODE FILE...
chmod(1,2) [OPTION]... --reference=RFILE FILE...
DESCRIPTION
This manual page documents the GNU version(1,3,5) of chmod(1,2). chmod(1,2) changes the
permissions of each given file(1,n) according to mode, which can be either a
symbolic representation of changes to make, or an octal number repre-
senting the bit pattern for the new permissions.
The format of a symbolic mode is `[ugoa...][[+-=][rwxXs-
tugo...]...][,...]'. Multiple symbolic operations can be given, sepa-
rated by commas.
A combination of the letters `ugoa' controls which users(1,5)' access(2,5) to the
file(1,n) will be changed: the user who owns it (u), other users(1,5) in(1,8) the
file(1,n)'s group (g), other users(1,5) not in(1,8) the file(1,n)'s group (o), or all users(1,5)
(a). If none of these are given, the effect is as if(3,n) `a' were given,
but bits that are set(7,n,1 builtins) in(1,8) the umask are not affected.
The operator `+' causes the permissions selected to be added to the
existing permissions of each file(1,n); `-' causes them to be removed; and
`=' causes them to be the only permissions that the file(1,n) has.
The letters `rwxXstugo' select(2,7,2 select_tut) the new permissions for the affected
users: read(2,n,1 builtins) (r), write(1,2) (w), execute (or access(2,5) for directories) (x),
execute only if(3,n) the file(1,n) is a directory or already has execute permis-
sion for some user (X), set(7,n,1 builtins) user or group ID on execution (s), save
program text on swap device (t), the permissions that the user who owns
the file(1,n) currently has for it (u), the permissions that other users(1,5) in(1,8)
the file(1,n)'s group have for it (g), and the permissions that other users(1,5)
not in(1,8) the file(1,n)'s group have for it (o).
A numeric mode is from one to four octal digits (0-7), derived by
adding up the bits with values 4, 2, and 1. Any omitted digits are
assumed to be leading zeros. The first digit selects the set(7,n,1 builtins) user ID
(4) and set(7,n,1 builtins) group ID (2) and save text image (1) attributes. The sec-
ond digit selects permissions for the user who owns the file: read(2,n,1 builtins) (4),
write(1,2) (2), and execute (1); the third selects permissions for other
users(1,5) in(1,8) the file(1,n)'s group, with the same values; and the fourth for
other users(1,5) not in(1,8) the file(1,n)'s group, with the same values.
chmod(1,2) never changes the permissions of symbolic links; the chmod(1,2) system
call cannot change their permissions. This is not a problem since the
permissions of symbolic links are never used. However, for each sym-
bolic link(1,2) listed on the command line, chmod(1,2) changes the permissions of
the pointed-to file. In contrast, chmod(1,2) ignores symbolic links encoun-
tered during recursive directory traversals.
OPTIONS
Change the mode of each FILE to MODE.
-c, --changes
like verbose but report only when a change is made
-f, --silent, --quiet
suppress most error(8,n) messages
-v, --verbose
output a diagnostic for every file(1,n) processed
--reference=RFILE
use RFILE's mode instead of MODE values
-R, --recursive
change files and directories recursively
--help display this help and exit(3,n,1 builtins)
--version
output version(1,3,5) information and exit(3,n,1 builtins)
Each MODE is one or more of the letters ugoa, one of the symbols +-=
and one or more of the letters rwxXstugo.
AUTHOR
Written by David MacKenzie.
REPORTING BUGS
Report bugs to <bug-fileutils@gnu.org>.
COPYRIGHT
Copyright 2001 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is
NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
SEE ALSO
The full documentation for chmod(1,2) is maintained as a Texinfo manual. If
the info(1,5,n) and chmod(1,2) programs are properly installed at your site, the
command
info(1,5,n) chmod(1,2)
should give you access(2,5) to the complete manual.
chmod(1,2) (fileutils) 4.1 April 2001 CHMOD(1)