- REVISION HISTORY
- COPYRIGHT and LICENSE
chmod - change permissions of files
chmod [-R [-H | -L | -P]] mode file [files ...]
chmod sets the permissions of files. The first argument after the options is permission the files should be given.
chmod accepts the options described below. The options -L, -H and -P are mutally exclusive, and only the last given option will be honoured. All of -L, -H and -P require the -R option to be set first.
Recurse into directories. Any directories are recursively traversed, and all files and directories will change owner.
Follow symbolic links. By default, chmod will not follow symbolic links. This is a potential dangerous option, as chmod will not check for cycles. Be careful. This option requires the -R option to be set.
Follow symbolic links of command line files/directories only. This option requires the -R option to be set.
Do not follow symbolic links at all. This option requires the -R option to be set.
Modes are either absolute, or symbolic. An absolute mode is an octal number, calculated by OR-ing the following values:
Suid on execution.
Guid on execution.
The sticky(8) bit is turned on.
Read permission for the ownwer of the file.
Write permission for the ownwer of the file.
Execute permission for the ownwer of the file.
Read permission for those in the group as the group of the file.
Write permission for those in the group as the group of the file.
Execute permission for those in the group as the group of the file.
Read permission for all others.
Write permission for all others.
Execute permission for all others.
Symbolic mode is a comma separated list of actions. Each action has the following format:
[who] operator [permissions] [operator [permissions] ...]
who consists of zero or more of the following symbols:
Permissions for the user (owner) of the file.
Permissions for the group of the file.
Permissions for all others.
Permissions for everyone.
If who is omitted, it will default to a, but the value of your umask is taken into account. chmod will then not set a permission that is masked by your umask.
The operator is one of:
Add permissions. If no permissions are given, this action is ignored. If who is absent, set the permission bit as indicated by permissions, but respect the umask settings. If who is given, set the permission bits as indicated by permissions, for those groups indicated by who.
Revoke permissions. If no permissions are given, this action is ignored. If who is absent, revoke the permission bit as indicated by permissions, but respect the umask settings. If who is given, revoke the permission bits as indicated by permissions, for those groups indicated by who.
Set permissions. The permission bits indicated by who are all cleared. If who isn't given, all permission bits are cleared. Then, if who isn't given, those permission bits in permission whose corresponding bit in the umask is clear are set. Otherwise, the permission bits are set as indicated by who and permission.
permission consists of zero or more of:
The read permission bit.
The write permission bit.
The execute permission bit.
The execute permission bit, but only if the target is either a directory, or has at least one execution bit set in the unmodified permission bits. Furthermore, this permission is ignored if operator is either - or =.
The suid and guid bit. These will have no effect in combination with the o who setting.
The sticky bit. This makes sense only for the others group, however, it will be ignored if o is the only group in the who part of the clause.
The original permissions of the user.
The original permissions of the group.
The original permissions for others.
The working of chmod is not influenced by any environment variables.
It is unlikely there are no bugs. The documentation is at best ambiguous. The OpenBSD documentation does not match the OpenBSD implementation. Furthermore, the implementations of Solaris, SunOS, HP, and GNU all differ from each other, and from OpenBSD.
This manual page needs work. The module SymbolicMode needs to be documented.
chmod parses a symbolic mode once for each file. That is too much redundant work.
chmod can loop forever when symbolic links create cycles.
chmod uses File::Find to recurse.
This manual should have been written in Texinfo, LaTeX, or a funky SGML application. pod2man, pod2html, pod2text and pod2latex are all broken beyond belief.
It does not make sense to talk about standards in a chmod manual page.
$Log: chmod,v $ Revision 1.2 2004/08/05 14:17:43 cwest cleanup, new version number on website Revision 1.1 2004/07/23 20:10:01 cwest initial import Revision 1.3 1999/03/09 02:44:57 abigail Fixed SybolicMode -> SymbolicMode typo. Revision 1.2 1999/03/08 03:07:28 abigail Major documentation tweaks. Revision 1.1 1999/03/07 12:03:54 abigail Initial revision
The Perl implementation of chmod was written by Abigail, email@example.com.
This program is copyright by Abigail 1999.
This program is free and open software. You may use, copy, modify, distribute, and sell this program (and any modified variants) in any way you wish, provided you do not restrict others from doing the same.