GNU bug report logs -
#18937
chmod ???? bug?
Previous Next
Reported by: Plato <platoxw <at> wishmail.net>
Date: Mon, 3 Nov 2014 18:33:02 UTC
Severity: normal
Tags: notabug
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
Full log
Message #18 received at submit <at> debbugs.gnu.org (full text, mbox):
Le 04/11/2014 18:47, Bob Proulx a écrit :
> Plato wrote:
>> After using chmod
>> chmod -R 644 /media/plato/mountedpartition/ (I see I forgot the * at the end)
> That is a problematic command regardless of the '*' at the end or
> not. If any of the arguments is a directory then it will set the
> directory permission to 644 as specified. But directories need the
> 'x' bit (execute permission) set as well.
>
> The above command will remove the execute bit from
> /media/plato/mountedpartition and then fail to search below it due to
> permission problems. It will then leave the directory in an unhappy
> state.
>
>> ls -l
>> listing has all entry's like these:
>> First a list like this of every file and folder
>> ls: cannot access /media/plato/mountedpartition/justafiile.txt: Permission denied
> That is correct when the execute permission is removed from a directory.
>
>> When I do
>> sudo ls Files
>> I get a listing of the contents of files as expected.
> This is because file mode bits only apply to non-root access. Root is
> the superuser and always has permission regardless of the file mode
> bits. Root always has access regardless of permissions.
>
>> Is this a bug?
> No. It is doing exactly what you told it to do.
>
> Try this:
>
> ls -ld /media/plato/mountedpartition
>
> The -d option will tell ls to show the argument itself instead of
> showing the contents of the directory. With that you will see
> something like this mode bits: drw-r--r-- but directories need to have
> the x bit there too like drwxrwxr-x typically.
>
>> It was not my intention to get this. I do not know how to get it back to what it was.
>> I tried it on a single file with
>> chmod 644 justafile.txt
>> but that did not solve it. Any ideas?
> After removing the execute bit from the directory you simply must add
> the execute bit back to the directory. It will probably be enough to
> do this using symbolic modes.
>
> chmod a+x /media/plato/mountedpartition
>
> In the old numeric form, combined with your previous 644, this would
> be similar to:
>
> chmod 755 /media/plato/mountedpartition
>
> Do not use the -R option with numeric arguments such as 644 because
> the numeric mode will be recursively applied across directories. That
> is almost never what you want. If using the -R option it is safer to
> use the symbolic modes such as go-w.
>
> Since this is all expected behavior I am going to go ahead and close
> this bug. However please continue the discussion here in the bug
> log. Any replies are still seen and discussed by the group.
>
> Bob
>
>
>
chmod -R u=rwX,g=rwX[s],o=[---|rX|rwX] /media/plato/mountedpartition/
(no need the *, implied by -R)
This bug report was last modified 10 years and 284 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.