GNU bug report logs - #18937
chmod ???? bug?

Previous Next

Package: coreutils;

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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18937 in the body.
You can then email your comments to 18937 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#18937; Package coreutils. (Mon, 03 Nov 2014 18:33:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Plato <platoxw <at> wishmail.net>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Mon, 03 Nov 2014 18:33:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Plato <platoxw <at> wishmail.net>
To: bug-coreutils <at> gnu.org
Subject: chmod ???? bug?
Date: Mon, 3 Nov 2014 19:26:25 +0100
Hello,

After using chmod
	chmod -R 644 /media/plato/mountedpartition/	(I see I forgot the * at the end)
my
	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
	Then one time
		total 0
	Folowed by
		-????????? ? ? ? ?            ? justafile.txt
		d????????? ? ? ? ?            ? Files
	One example of a file and one of a directory

If I do
	ls Files
I get
	ls: cannot access /media/plato/mountedpartition/Files: Permission denied
When I do
	sudo ls Files
I get a listing of the contents of files as expected.

Is this a bug?
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?

Thanks for maintaining chmod
-- 
With kind regards,

Plato




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Mon, 03 Nov 2014 22:14:02 GMT) Full text and rfc822 format available.

Notification sent to Plato <platoxw <at> wishmail.net>:
bug acknowledged by developer. (Mon, 03 Nov 2014 22:14:02 GMT) Full text and rfc822 format available.

Message #10 received at 18937-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Plato <platoxw <at> wishmail.net>, 18937-done <at> debbugs.gnu.org
Subject: Re: bug#18937: chmod ???? bug?
Date: Mon, 03 Nov 2014 14:13:08 -0800
On 11/03/2014 10:26 AM, Plato wrote:
> chmod -R 644/media/plato/mountedpartition/

The behavior you observe is what I'd expect once the permissions on 
directories are messed up. To fix it, try "chmod -R 
+X/media/plato/mountedpartition/" as root.




Added tag(s) notabug. Request was from Bob Proulx <bob <at> proulx.com> to control <at> debbugs.gnu.org. (Tue, 04 Nov 2014 17:45:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-coreutils <at> gnu.org:
bug#18937; Package coreutils. (Tue, 04 Nov 2014 17:48:01 GMT) Full text and rfc822 format available.

Message #15 received at 18937 <at> debbugs.gnu.org (full text, mbox):

From: Bob Proulx <bob <at> proulx.com>
To: Plato <platoxw <at> wishmail.net>
Cc: 18937 <at> debbugs.gnu.org
Subject: Re: bug#18937: chmod ???? bug?
Date: Tue, 4 Nov 2014 10:47:05 -0700
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




Information forwarded to bug-coreutils <at> gnu.org:
bug#18937; Package coreutils. (Thu, 06 Nov 2014 09:45:02 GMT) Full text and rfc822 format available.

Message #18 received at submit <at> debbugs.gnu.org (full text, mbox):

From: f0rhum <f0rhum <at> free.fr>
To: bug-coreutils <at> gnu.org
Subject: Re: bug#18937: chmod ???? bug?
Date: Thu, 06 Nov 2014 10:43:42 +0100
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)




Information forwarded to bug-coreutils <at> gnu.org:
bug#18937; Package coreutils. (Thu, 06 Nov 2014 09:58:01 GMT) Full text and rfc822 format available.

Message #21 received at 18937 <at> debbugs.gnu.org (full text, mbox):

From: f0rhum <f0rhum <at> free.fr>
To: 18937 <at> debbugs.gnu.org
Subject: Re: bug#18937: chmod ???? bug?
Date: Thu, 06 Nov 2014 10:57:53 +0100
[Message part 1 (text/plain, inline)]
chmod -R u=rwX,g=rwX[s],o=[---|rX|rwX] /media/plato/mountedpartition/
(no need the *, implied by -R)

[Message part 2 (text/html, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 04 Dec 2014 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 283 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.