Jump to content

Talk:chmod

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia


comments from 2002 2003

[edit]
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

Chmod used in webservers

[edit]

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

Man page dump

[edit]

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)[reply]

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)[reply]

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)[reply]

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)[reply]

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)[reply]

The other chmod

[edit]

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

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)[reply]

"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)[reply]

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

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)[reply]

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)[reply]

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)[reply]

"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)[reply]

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 (talkcontribs) 16:18, 19 October 2013 (UTC)[reply]

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)[reply]

"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)[reply]

@Anon
They're neither binary nor decimal; they're octal. Martin Kealey (talk) 02:58, 14 April 2025 (UTC)[reply]
  • 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)[reply]

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)[reply]


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)[reply]

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)[reply]

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)[reply]

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)[reply]

It seems an interesting point to include. I did try to diminish it's importance by removing it from the first sentence. Stevebroshar (talk) 11:48, 11 April 2025 (UTC)[reply]

As no-one has responded I have removed the system call section DGerman (talk) 01:03, 27 August 2021 (UTC)[reply]

I often don't get replies to what I write in talk. ... Impressive that you waited 6 years for a reply before making the change. Stevebroshar (talk) 11:50, 11 April 2025 (UTC)[reply]

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)[reply]

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)[reply]

Recent merge discussions

[edit]

See:

wbm1058 (talk) 14:31, 26 December 2020 (UTC)[reply]

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)[reply]

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.

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)[reply]

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)[reply]
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)[reply]