Talk:chmod
![]() | This article is rated B-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | ||||||||||||||||
|
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
WHY JUST UPLOAD A MAN PAGE? DUMB.
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
SYNOPSIS
chmod [-Rcfv] [--recursive] [--changes] [--silent] [--quiet] [--verbose] [--help] [--version] mode file...
DESCRIPTION
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.
- Where would I got to suggest something like this as an addition to the man page included with most distros? The page is written in a less-readable style (paragraphs 3 and 6 in the description section don't make this obvious)? A line like this at the beginning would quickly tell someone what order the parameters are in (it's entirely arbitrary). Making it concise helps with this.
- '*AAABBBCCC AAA=Owner, BBB=Group, CCC=Everyone else' Also could have writen [d][owner][group][everyone] but less clear? — Preceding unsigned comment added by 2A0B:7080:10:0:0:0:1:E187 (talk) 02:35, 16 May 2018 (UTC)
- If you are looking for the Linux man-pages project, see the links here. -LiberatorG (talk) 11:24, 16 May 2018 (UTC)
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)
Tables
[edit]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. 87.194.164.154 (talk) 11:17, 14 July 2008 (UTC)
Examples section markup
[edit]That examples should semantically be represented by an HTML table. --85.179.194.128 (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. 71.131.178.118 (talk) 14:44, 11 July 2011 (UTC)
comment
[edit]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 94.30.109.74 (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) 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
8th edition (symbolic modes but no +X) http://man.cat-v.org/unix_8th/1/chmod — Preceding unsigned comment added by 207.255.14.95 (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: 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.
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 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
++++ 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]"
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.— Preceding unsigned comment added by 207.255.14.95 (talk) 20:01, 23 July 2012 (UTC)
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 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)
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 92.201.131.190 (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 213.216.142.12 (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)
References
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)
As no-one has responded I heave removed the system call section DGerman (talk) 01:03, 27 August 2021 (UTC)
screenshot helpful or confusing
[edit]Is the green on black screen shot, which in nearly impossible to read, really helpful?
If there are no objections I will remove it after August 2019. DGerman (talk) 21:42, 22 July 2019 (UTC)
OK after 2 1/2 years I'm deleting the screen shot.
much rework needed
[edit]This article has taken a literary feeling. I have removed the references to decimal and some of the binary ones (other than in the table) as unnecessary confusing. I will (unless someone else does ) rework the section on combining flags to determine rights and the references to odd, subtracting nothing if..., only if it is greater than or equal to ...
Also as someone has mentioned previously, the entire discussion about what modes are and what they permit is out of scope and is referenced the beginning of the article DGerman (talk) 01:20, 12 April 2021 (UTC)
Recent merge discussions
[edit]See:
- Talk:Modes (Unix)#Should this redirect to chmod and
- Talk:Unix file types#Proposed merge of Modes (Unix) into Unix file types.
– wbm1058 (talk) 14:31, 26 December 2020 (UTC)
stat structure not helpful, propose deletion
[edit]The early paragraph discussing the stat structure might belong with the file permissions but not in the chmod command. Unless anyone disagrees I'll delete it next time I'm here. DGerman (talk) 01:07, 27 August 2021 (UTC)
Animated screenshot
[edit]I think we need to discuss this: Can we make all screenshots animated? I have done animated screenshots in GIF for some (including this one) but people said they are slow, hard to read and small.
![](http://upload.wikimedia.org/wikipedia/commons/thumb/f/f7/Chmod-example-command.gif/220px-Chmod-example-command.gif)
I knew it myself and suggested to Commons to implement asciinema support: https://commons.m.wikimedia.org/wiki/Commons:Village_pump/Proposals/Archive/2022/02#Implementing_support_for_asciinema_cast_files
So what can be done? I want the command pages to look pretty as they look dull without ss or with ss that are low quality. --Comrade-yutyo (talk) 21:11, 3 April 2022 (UTC)
- I agree that screen shots that are low quality are not desirable.
- Unfortunately the commands and command line are "dull".
- They are not graphical.
- Screen shots or animated screen shots that are simply the typing of the command do not add anything.
- An animated screen shot for something like aptitude however would, if done well, add something as it would show how the process works. DGerman (talk) 02:59, 4 April 2022 (UTC)
- I agree with DGerman. Most screenshots can simply be replaced with text. Animated screenshots are even worse if they are slow. However, articles about a software utility that doesn't print its output all at once (like ping or CMake) could benefit from an animated GIF. I prefer GIFs that are recorded as the user types, though, because the GIFs where the input is played back character by character feel very unnatural. Dexxor (talk) 06:56, 4 April 2022 (UTC)
Start a discussion about improving the Chmod page
Talk pages are where people discuss how to make content on Wikipedia the best that it can be. You can use this page to start a discussion with others about how to improve the "Chmod" page.
- B-Class Computing articles
- Mid-importance Computing articles
- B-Class software articles
- Unknown-importance software articles
- B-Class software articles of Unknown-importance
- All Software articles
- B-Class Free and open-source software articles
- Mid-importance Free and open-source software articles
- B-Class Free and open-source software articles of Mid-importance
- All Free and open-source software articles
- All Computing articles