|WikiProject Free Software / Software / Computing||(Rated B-class, Mid-importance)|
- 1 comments from 2002 2003
- 2 Chmod used in webservers
- 3 Man page dump
- 4 Removed the wrong-title tamplate from the dump
- 5 Rewrite and Section Update
- 6 String mode examples
- 7 Tables
- 8 Screenshot of man dump
- 9 Examples section markup
- 10 The other chmod
- 11 "Particular care should be taken when a directory is the target because the effect is not intuitive."
- 12 comment
- 13 References for when did +X appear
- 14 Suggestions for improvements
- 15 names consistent with usage
- 16 Poor example
- 17 "Numerical permissions" is difficult to understand (not useless)
- 18 Splitting up 'modes' table
- 19 Is System call useful
comments from 2002 2003
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
WHY JUST UPLOAD A MAN PAGE? DUMB.
Chmod used in webservers
Perhaps this should be explored since most webservers use CHMOD on FTP type operations.
Man page dump
(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 successfully.
--version Print version information on standard output then exit successfully.
Removed the wrong-title tamplate from the dump
-don't want it on the talk page. Rich Farmbrough 14:09, 29 Jan 2005 (UTC)
Rewrite and Section Update
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
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)
Screenshot of man dump
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. 22.214.171.124 (talk) 11:17, 14 July 2008 (UTC)
Examples section markup
- 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
- 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."
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 126.96.36.199 (talk) 12:05, 5 March 2010 (UTC)
References for when did +X appear
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) http://www.scribd.com/doc/4001642/56/Changing-Permissions-chmod#page=67
Unix first edition man page (11/3/71, only octal modes provided) http://man.cat-v.org/unix-1st/1/chmod
6th edition (still only octal) http://man.cat-v.org/unix-6th/1/chmod
Suggestions for improvements
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: http://ubuntuforums.org/showthread.php?t=1658076
Mac OS X (and BSD?) support changing access control lists via chmod. https://developer.apple.com/library/mac/#documentation/Darwin/Reference/Manpages/man1/chmod.1.html
"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.
% mkdir d % ls -ld d drwxrwxr-x. 2 user group 4096 Jul 23 15:45 d % echo a>d/a % cat d/a a % head d/* a % echo b>d/b % head d/* ==> d/a <== a ==> d/b <== b % head d/a d/b ==> d/a <== a ==> d/b <== 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 <== a ==> d/b <== 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
- "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:" http://ss64.com/bash/chmod.html is not the most appropriate, although it seems to be a better man page than some.
ss64.com (http://ss64.com/docs/ "About SS64.com, 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
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 findPhoneNumbers.sh 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 (talk • contribs) 16:18, 19 October 2013 (UTC)
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 188.8.131.52 (talk) 00:32, 28 November 2013 (UTC)
"Numerical permissions" is difficult to understand (not useless)
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 184.108.40.206 (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.
Splitting up 'modes' table
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.
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 ||Directory ||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.
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)
Is System call useful
Is it useful to include the system call in this (or actually any unix command) page?