On Fri, Apr 10, 2009 at 2:43 PM, Daniel Pittman <[email protected]> wrote:
> Bernie Pannell <[email protected]> writes:
>
>> try doing the 2 commands in the opposite order, setting everything to
>> 664, & then set the directories to 775, ie:
>>
>> chmod -R 664*
>> chmod -R 775 *.
>
> Epic FAIL!
>
> The first command will remove the execute bit from every directory,
> causing you some incredible grief, and then the second command just
> won't work because you no longer have permissions to get at the
> contained files sensibly.

Homework:

mkdir A
touch A/B
touch A/C
chmod u-x A
ls -l A
rm A/B

marvel at the weird. Also, remember, because one day you'll see this
behaviour again, and having seen it before will save you from a very
baffling 30 minutes while you fight against the machine.

>
> It /could/ work if you did this:  chmod -R ug=rwX,o=rX *
>
> That uses the GNU chmod specific "only set executable if this is a
> directory" flag,

Close. Quoting from the man page:

execute/search only  if  the file is a directory or already has
execute permission for some user

Hrm. "Only if the file is a directory" could probably be worded better.

> which works more nicely, but probably isn't exactly the
> right answer in the long term.
>
> Regards,
>        Daniel
> --
> SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
> Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
>
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to