--reference=reffile use
Symbolic-Mode
chmod [Options]… symbolic-mode file … ead ,
chmod [Options]…
m m m file …
reffile's mode
-R, --recursive
-f, --silent, --quiet suppress most error messages
-v, --verbose show files processed
-c, --changes show files changed
--help
--version
[ugoa] [+-=][rwx Xst]
ugoa specifies which users' access to the file will be changed:
user who owns it
Other users in the file's group
other users i.e. not the user who owns it and not users in the file's group
all users ( i.e. ugo)
Default is a but bits that are set in the umask are not affected.+ adds to the existing modes ,
- removes modes, and
= sets modesrwx Xst select the modes for the specified users:
rwrite, execute
eXecute only if the file is a directory or already has execute permission for some user
Set user or group ID on execution†
Save program text on swap device ( a performance enhancer )
For a directory mode means: read:list files, write:add, execute:access
Examples
chmod a-w file chmod a+r filechmod g+rw filechmod =rx,g+s file
| first digit | special attributes for usually not used |
| ||||||
| second digit | owner |
| ||||||
| third digit | group |
| ||||||
| fourth digit | other users NOT in the file's group |
|
The mode is calculated by adding the values
Owner (rwx) = 400+200+100= 700 ; Group(rx) = 40+10 = 50; Other (rx) = 4+1 = 5
mode = 755
Setting mode to 777 should be avoided as this permits anyone to modify the file.
chmod 750 file
ls -l file
-rwxr-x--- 1 dgerman users 978 22 May 19:10 file
chmod 760 file
ls -l file
-rwxrw---- 1 dgerman users 978 22 May 19:10 file
The mode of symbolic links are not changed since they are not used.
The mode of the target file are changed except during recursive directory traversals.
This page documents the GNU version of chmod.
see also:
ls -l lists current permissions for --
u (owner) rwx -- g (group) rwx -- O (Other) rwx --
chgrp - Change group ownership
chown - Change file owner and group
umask - sets defaults ( actually the complement !
Windows equivalent commands:
ATTRIB - Change file attributes
CACLS - Change AccessControlList settings
XCACLS - Change file permissions