modeof a new file is set based on the umask )
chmod [Options]… symbolic-mode file … use
chmod [Options]… m m m file …
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.
a but bits that are set in the umask are not affected.
+ adds to the existing modes ,
- removes modes, and
= sets modes
rwx Xst select the modes for the specified users:
For a directory mode means: read:list files, write:add, execute:access
Xecute only if the file is a directory or already has execute permission for some user
Set user or group ID on execution†
text on swap device ( a performance enhancer )
chmod a-w file
chmod a+r file
chmod g+rw file
chmod =rx,g+s file
|first digit|| special attributes |
usually not used
|fourth digit|| other|
users NOT in the file's group
mode is calculated by adding the values.
User (owner) (rwx) = 400+200+100= 700 ; Group(rx) = 40+10 = 50; Other (x) = 1 results in: mode = 751
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 team2 978 22 May 19:10 file
chmod 760 file
ls -l file
-rwxrw---- 1 dgerman team2 978 22 May 19:10 file
For symbolic links: the mode is not changed since they are not used. The mode of the target file is changed except during recursive directory traversals.
This page documents the GNU version of chmod.
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 "allowed" filter
Windows equivalent commands:
ATTRIB - Change file attributes
CACLS - Change AccessControlList settings
XCACLS - Change file permissions
and for us Mac ers