Directories without 'x'
David Bandel
david.bandel
Wed Feb 23 11:53:29 PST 2005
On Wed, 23 Feb 2005 08:10:17 -0600, Michael Hipp <Michael at hipp.com> wrote:
> Well, I'm proud of myself 'cause I solved a problem that had been giving me
> headaches for weeks. I have some cron scripts that do things with deep
> directory trees that have 10,000s of files in them. Eventually found out that
> deep down there were a bunch of directories not set executable, like this:
>
> drw-r-xr-x 2 michael michael 6 2005-02-23 07:57 test
> ^
> I found out that directories without the 'x' are very bad actors. Bash scripts
> fail in mysterious ways or keep running but don't do anything or sometimes
> seem to work fine, etc. Anyway, eventually solved it like this:
>
> To paint a target on them:
> find -type d ! -perm +u+x -exec ls -ld '{}' \;
>
> To fix the problem:
> find -type d ! -perm +u+x -exec chmod u+x '{}' \;
>
> Thought I'd pass it along while I'm feeling cocky :-)
The x on a directory allows you to cd into the directory. Likewise,
the r is for read a subdirectory listing and w to write into the
directory.
If you think about each of these and what they mean to you as a user,
you'll start to understand why your scripts failed. Basically, they
are commands run as you, so whatever you can or can't do is translated
to any script you run.
Now, that said, you can see why incoming directories are chown'd -wx.
You can write a file, but can't see names of others.
Also note the difference between a script and an executable (ELF) file
in a directory. Lots of fun stuff to annoy friends with here.
Ciao,
David A. Bandel
--
Focus on the dream, not the competition.
- Nemesis Air Racing Team motto
More information about the Linux-users
mailing list