From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Free Software / Software / Computing  (Rated B-class, Mid-importance)
WikiProject icon This article is within the scope of WikiProject Free Software, a collaborative effort to improve the coverage of free software on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
B-Class article B  This article has been rated as B-Class on the project's quality scale.
 Mid  This article has been rated as Mid-importance on the project's importance scale.
Taskforce icon
This article is supported by WikiProject Software (marked as Mid-importance).
Taskforce icon
This article is supported by WikiProject Computing (marked as Mid-importance).

comments from 2002 2003[edit]

Is it appropriate to just dump man pages here?  :-) -- Marj Tiefert, Saturday, April 27, 2002

probably not. -- Tarquin 21:54 27 May 2003 (UTC)
No context is established or anything. Since the present article actually contains a lot of information, maybe it is not inviting to rewrite the article. -- Sverdrup 19:30, 10 Dec 2003 (UTC)
(Note: it has not been touched since april 2002. Thus, we cannot have an article in this state. I'll replace it with a temporary article with less information content.) Sverdrup


Most man pages, different for each implementation, while provide exact syntax do not discuss uses or reasons or ramifications of commands. DGerman (talk) 22:04, 16 December 2012 (UTC)

Chmod used in webservers[edit]

Perhaps this should be explored since most webservers use CHMOD on FTP type operations.

Man page dump[edit]

(Old article content)

      chmod - change the access permissions of files


      chmod   [-Rcfv]   [--recursive]   [--changes]   [--silent]
      [--quiet] [--verbose] [--help] [--version] mode file...


      This manual page  documents  the  GNU  version  of  chmod.
      chmod changes the permissions of each given file according
      to mode, which can be either a symbolic representation  of
      changes  to  make, or an octal number representing the bit
      pattern for the new permissions.
      The format of a symbolic mode  is  `[ugoa...][[+-=][rwxXs-
      tugo...]...][,...]'.   Multiple symbolic operations can be
      given, separated by commas.
      A combination of the letters `ugoa' controls which  users'
      access  to  the file will be changed: the user who owns it
      (u), other users in the file's group (g), other users  not
      in  the  file's  group  (o), or all users (a).  If none of
      these are given, the effect is as if `a' were  given,  but
      bits that are set in the umask are not affected.
      The  operator  `+'  causes  the permissions selected to be
      added to the existing permissions of each file; `-' causes
      them  to  be  removed;  and `=' causes them to be the only
      permissions that the file has.
      The letters `rwxXstugo' select the new permissions for the
      affected  users:  read  (r), write (w), execute (or access
      for directories) (x), execute only if the file is a direc-
      tory  or already has execute permission for some user (X),
      set user or group ID on execution (s), save  program  text
      on swap device (t), the permissions that the user who owns
      the file currently has for it (u),  the  permissions  that
      other  users  in the file's group have for it (g), and the
      permissions that other users not in the file'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 user ID (4) and set  group  ID
      (2)  and save text image (1) attributes.  The second digit
      selects permissions for the user who owns the  file:  read
      (4), write (2), and execute (1); the third selects permis-
      sions for other users in the file's group, with  the  same
      values;  and  the fourth for other users not in the file's
      group, with the same values.
      chmod never changes the permissions of symbolic links; the
      are never used.  However, for each symbolic link listed on
      the command line, chmod changes  the  permissions  of  the
      pointed-to  file.   In  contrast,  chmod  ignores symbolic
      links encountered during recursive directory traversals.
      -v, --verbose
             Verbosely describe changed permissions.
      -R, --recursive
             Recursively change permissions of  directories  and
             their contents.
      --help Print  a  usage message on standard output and exit
             Print version information on standard  output  then
             exit successfully.

Removed the wrong-title tamplate from the dump[edit]

-don't want it on the talk page. Rich Farmbrough 14:09, 29 Jan 2005 (UTC)

Rewrite and Section Update[edit]

I added some content, and simplified the sections. Hopefully this rewrite is more readable and understandable. Gbeeker 15:32, 9 September 2005 (UTC)

String mode examples[edit]

I created a subsection of string mode examples, and then realized there is already an example section. Both can probably be combined. When I have a chance, I'll do that, unless someone else beats me to it. --Unixguy 19:39, 8 December 2006 (UTC)


Anyone wanna clean up that table with the usage? The X entry is particularly long and hard to read. — SheeEttin {T/C} 23:08, 6 March 2007 (UTC)

Screenshot of man dump[edit]

Really? Wouldn't it be better replaced with a screen shot of usage? Is an image even necessary at all? There are already external links to various man pages and that screenshot is too small to use comfortably anyway. Not to mention the fact anyone likely to need the chmod man page probably has access to it via their terminal. (talk) 11:17, 14 July 2008 (UTC)

Examples section markup[edit]

That examples should semantically be represented by an HTML table. -- (talk) —Preceding undated comment was added at 22:52, 31 August 2008 (UTC)

you can do that kind of stuff yourself, too, but I'm not sure if it's any better now Yngvarr (t) (c) 23:04, 31 August 2008 (UTC)

The other chmod[edit]

Just adding information about the Unix function of the same name.--Rfsmit (talk) 23:02, 17 March 2009 (UTC)

Done. If you feel like reverting it, consider moving the information I added to a new article.--Rfsmit (talk) 23:28, 17 March 2009 (UTC)

"Particular care should be taken when a directory is the target because the effect is not intuitive."[edit]

Can we be a little more specific about what happens? Tisane (talk) 20:19, 9 April 2010 (UTC)

This article isn't useful for instruction anyway, so there's no need. (talk) 14:44, 11 July 2011 (UTC)


typical more documentation written by linux geeks (i mean that in a good way) that don't know how to write documentation for the rest of us (i mean that in a bad way). —Preceding unsigned comment added by (talk) 12:05, 5 March 2010 (UTC)

References for when did +X appear[edit]

I recently encountered the +X option and wondered when it was added, so I started searching around.

Here are some web pages which seem to be reliable copies of old documents.

Solaris 2.x Advanced User Guide (page images, does not mention +X)

Unix first edition man page (11/3/71, only octal modes provided)

6th edition (still only octal)

8th edition (symbolic modes but no +X) — Preceding unsigned comment added by (talk) 18:45, 23 July 2012 (UTC)

Suggestions for improvements[edit]

I don't have time to edit the article just now. But here are some suggestions.

"Experienced Unix and Linux users tend to recommend that the user of this command check the man page (man chmod) on the system of interest."

Change to something like

Users of old versions of Unix should check the man page. (with footnote references to old man pages).

Or just delete the sentence.

Add information about using Linux chmod on NTFS volumes such as Windows shared via Samba, USB keys, USB external hard disks formatted as NTFS. It seems it may not work:

Mac OS X (and BSD?) support changing access control lists via chmod.

"Octets" is just the wrong word. An octet is eight bits, not an octal digit (3 bits).

The footnote on "respectively" gives the definition of the word, not support for the statement. Someone please change it...

"Particular care should be taken when a directory is the target because the effect is not intuitive.[according to whom?]"

Change to something like

"Note that the read and execute permissions on a directory have a different meaning: read access to a directory provides access to the 'names' of the files and subdirectories, while execute access provides access to the 'contents' (and attributes such as file size) provided that the name is already known.

Add examples:

% mkdir d
% ls -ld d
drwxrwxr-x. 2 user group 4096 Jul 23 15:45 d
% echo a>d/a
% cat d/a
% head d/*
% echo b>d/b
% head d/*
==> d/a <==

==> d/b <==
% head d/a d/b
==> d/a <==

==> d/b <==
% chmod a-r d
% head d/*
head: cannot open `d/*' for reading: No such file or directory
% head d/a d/b
==> d/a <==

==> d/b <==
% chmod a+r,a-x d
% echo d/*
d/a d/b
% head d/*
head: cannot open `d/a' for reading: Permission denied
head: cannot open `d/b' for reading: Permission denied
% head d/a d/b
head: cannot open `d/a' for reading: Permission denied
head: cannot open `d/b' for reading: Permission denied

And some more examples similar to the above to cover other permutations.

such as the output from these (after a little more work):

export PS1='% '
mkdir d
ls -ld d
echo a>d/a
cat d/a
head d/*
echo b>d/b
head d/*
head d/a d/b
chmod a-r d
head d/*
head d/a d/b
chmod a+r,a-x d
echo d/*
head d/*
head d/a d/b
ls -ld d
chmod a=w d
ls -ld d
ls -al d
echo c>d/c
chmod a+r d
ls -al d
ls -ld d
chmod a=wx d
ls -ld d
ls -al d
echo c>d/c
head d/a d/b d/c
head d/*
echo d/*
chmod a=r d
echo d/*
ls -ld d
ls -al d
chmod a=x d
ls -ld d
ls -al d
echo d/*
head d/a d/b d/c
head d/a d/b d/c d/d
rm d/a
rm -f d/a
chmod a=w d
ls -ld d
ls -al d
rm -f d/a
chmod a=wx d
ls -ld d
ls -al d
rm -f d/a
head d/a d/b d/c d/d

++++ Please avoid using meaningless names. DGerman (talk) 22:10, 16 December 2012 (UTC)

"In addition, it will not work on all file types. For example, it has no effect on a symbolic link."

This is not correct. It has an effect, changing the mode of the pointed to file or directory if the link was mentioned on the command line, but doing nothing for links encountered in recursive traversal.

The cited reference on "The chmod command options are specified like this:[2]" is not the most appropriate, although it seems to be a better man page than some. ( "About, Simon Sheppard’s website") seems to be accurate but not authoritative.

I suspect the best choice would be the FSF page.

names consistent with usage[edit]

There is much documentation available which defines the syntax of a command without conveying an understanding of the usage.

I have tried to use meaningful words in filenames like "blest" (past participle of bless) to imply why one would want to remove write access. As well as which is supposed to be a script which warrants the use of the execute mode where the name phoneNumbers has not reasonable use for an execute attribute. — Preceding unsigned comment added by DGerman (talkcontribs) 16:18, 19 October 2013 (UTC)

Poor example[edit]

Coming across this article I noticed the poor Wheel of Fortune example. It has 8x more negative than positive ratings on YouTube. It is not even clear, that the contestants chose the letters on intent. It even looks like it was a coincident, because they were given an additional joker letter for their last turn - I'm not familiar with the rules of the game.

I'm not certain if I could edit it myself, but it should certainly be put to discussion. This little part of the article is not what I'm used from the high standards of Wikipedia. — Preceding unsigned comment added by (talk) 00:32, 28 November 2013 (UTC)

"Numerical permissions" is difficult to understand (not useless)[edit]

This lists numbers in binary, but chmod does not take numbers in binary format! It takes them in decimal. This needs a new column with the numbers in decimal please.

I came to this page trying to find out how to decide the a decimal number if I know I want permissions X Y and Z. I left the page no wiser than when I arrived :( The man page also does not help. — Preceding unsigned comment added by (talk) 15:21, 4 March 2014 (UTC)

  • The numbers in binary are under the column RWX and refer to which flag is set when using the #.
  • Perhaps you need to read the entires article, including the examples to gain an understanding of how to use the OCTAL numbers.
  • Better still, avoid using the admittedly cryptic octal modes and use the symbolic ones which took significant effort to implement.

DGerman (talk) 20:58, 9 July 2014 (UTC)

Splitting up 'modes' table[edit]

The modes r,w, and x have vastly different effects dependent on if it's a file[1] or a folder[2], which I don't think is clear enough in the current tables.

First of all, the description above the table talks about "three basic modes" but the table shows those three (r, w, x), plus three special modes (+X, s, t). I think "special execute", "setuid/gid" and "sticky" should move into the "Special Modes" section, but still refer to them close to the "three basic modes" table - or is there a good reason for having them here?

As a second step, I think there should be two "three basic modes" tables, one for files and one for folders, to make it easier to list the differences in behaviour, and especially noting the effect on whether you can create/delete/rename/list/execute/etc a file or folder, which currently isn't clearly shown.

This is an RFC, if anyone has some suggestions/amendments to the above, please let me know - I could make the actual changes next week-ish.Mwoc87 (talk) 17:02, 4 December 2014 (UTC)

The three basic modes are self-explanatory for files, but for directories, the abilities to read, write and execute have a special meaning, as shown in the following table, and explained by allegory below it:

Mode File [3] Directory [4] Extra conditions
r read list its content x on all parent directories
w write create, rename, and delete files in it x on this directory and all parent directories
x execute access (x) this directory and its content x on all parent directories

The special meaning of read, write and execute modes for directories, and the interplay between the execute mode and read/write modes, can be explained by allegory - a directory can be seen as a book containing chapters (files). Read permissions on the book would give an index with chapter titles, e.g. on the cover of the book. For a full index, and everything else, accessing (x) the book is required. Adding, deleting or moving chapters requires write access to the book. Following the allegory, a child directory would be a book inside a book, to which the same rules apply.

Draft of new tables above, WIP. Please leave a message if you have edited it, or have suggestions.Mwoc87 (talk) 21:31, 4 December 2014 (UTC)

Have added a separate table on the effect on sub-directories, to explicitly mention that the 'r' and 'w' flags have no recursive effect on sub-directories, but that 'x' does. Ninja edit: Maybe it should be put into one table again, but with three columns for Files, Directories and Sub-Directories. Mwoc87 (talk) 12:26, 5 December 2014 (UTC)

New draft of a single table. Not sure if it's clear enough. Will think about improvements.Mwoc87 (talk) 22:38, 5 December 2014 (UTC)

Is System call useful[edit]

Is it useful to include the system call in this (or actually any unix command) page?

DGerman (talk) 17:13, 30 August 2015 (UTC)

  1. ^
  2. ^
  3. ^
  4. ^