• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

chmod

chmod

chmod Changes file modes.
chmod [-R [-H | -L | -P]] [-h] <absolute_mode>
								<file1>
									<file2> ...

chmod [-R [-H | -L | -P]] [-h] <symbolic_mode>
								<file1>
									<file2> ...

-R Recursively descends through directory arguments to change file modes.
-H If -R is specified, symbolic links on the command line are followed. Symbolic links encountered in tree traversal are not followed.
-L If -R is specified, all symbolic links are followed.
-P If -R is specified, no symbolic links are followed.
Unless -H or -L is specified, chmod on a symbolic link always succeeds and has no effect. -H, -L, and -P options are ignored unless -R is specified. Furthermore, -H, -L, and -P override each other. The last option specified determines the action that is taken.
Permissions are described by three sequences of letters in the order listed here. Each sequence describes the permissions for user, group, and other. If a certain permission has not been granted, a - (dash) appears in its place.
user     group    other
rwx      rwx      rwx
The permissions on a file can be viewed using ls -l and changed using chmod.
Absolute mode  
Absolute mode is constructed by ORing any of the following modes:
4000 Sets user ID on execution.
2000 Sets group ID on execution.
1000 Turns on sticky bit.
0400 Allows read by owner.
0200 Allows write by owner.
0100 Allows execute (search in a directory) by owner.
0600 Allows read, write by owner.
0500 Allows read, execute by owner.
0300 Allows write, execute by owner.
0700 Allows read, write, execute by owner.
0040 Allows read by group.
0020 Allows write by group.
0010 Allows execute (search in a directory) by group.
0060 Allows read, write by group.
0050 Allows read, execute by group.
0030 Allows write, execute by group.
0070 Allows read, write, execute by group.
0004 Allows read by others.
0002 Allows write by others.
0001 Allows execute (search in a directory) by others.
0006 Allows read, write by others.
0005 Allows read, execute by others.
0003 Allows write, execute by other.
0007 Allows read, write, execute by others.
Symbolic mode  
Symbolic mode is a comma-separated list with no intervening whitespace of the form:
[<who>]<operator>[<permissions>]

<who> has the following form:  
									< u | g | o | a>

 
u User's permissions.
g Group's permissions.
o Others' permissions.
a All permissions (user, group, other). Equivalent to ugo.
<operator> has the following form:
									< + | - | =>
								

 
+ Adds <permissions>.

If <permissions> is not specified, no changes occur.

If <who> is not specified, <who> defaults to a, and <permissions> are added as specified, except that chmod does not override the file mode creation mask.

If <who> is specified, <permissions> are added as specified.
-Removes <permissions>.

If <permissions> is not specified, no changes occur.

If <who> is not specified, <who> defaults to a, and <permissions> are removed as specified, except that chmod does not override the file mode creation mask.

If <who> is specified, <permissions> are removed as specified.
= Assigns the absolute <permissions> specified.

If <who> is not specified, <who> defaults to a.

If <permissions> is not specified, <permissions> defaults to remove.

If <who> is specified and <permissions> is not, all permissions for <who> are removed.

If <who> is not specified and <permissions> is specified, <permissions> for all are set to <permissions>, except that chmod does not override the file creation mask.

If <who> is specified and <permissions> is specified, <permissions> for <who> are set as specified.
<permissions> has the following form:
									<r | w | x | X | s | t | u | g | o>
								

r Sets read bits.
w Sets write bits.
x Sets execute/search bits.
X Sets execute/search bits if the file is a directory, or if any execution/search bits are already set in the file before X would act upon the file. X is used only with +, and is ignored in all other cases.
s Sets the set-user-ID-on-execution and set-group-ID-on-execution bits. A process runs as the user or group specified by s.
t Sets the sticky bit.
u User permission bit in the mode of the original file.
g Group permission bits in the mode of the original file.
o Other permission bits in the mode of the original file.
Operations on <who> or in combination with <permissions> s or t are ignored.



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint