0
  1. What is an executable directory?

  2. If o+w is set the directory changes colors to a background green, what does this mean? Why doesn't it do it for ug+w, but only for o+w?

  3. Additional question after reading the comments: Is making a directory executable a security risk? If so, why?

17
  • why do you want to make a directory executable? that seems to pose a HUGE security risk
    – jgr208
    Commented Oct 18, 2014 at 23:21
  • I'm playing around with permissions, trying to figure out the implications. Commented Oct 18, 2014 at 23:21
  • well if you are not the owner of the file and try to make the file you dont own executable I don't think it will like that as well as not in the group that owns the file, they will not want you to be able to make a file you don't own executable.
    – jgr208
    Commented Oct 18, 2014 at 23:22
  • 2
    @jgr208 Where are you getting all this 'security risk' stuff from? Op doesn't mention anything about what this directory is being used for.
    – phemmer
    Commented Oct 18, 2014 at 23:26
  • 4
    @jgr208 You are aware that directories have to have the executable bit set to be of any use correct? Are you also aware that /, /bin, and numerous other directories are globally executable? Are you also aware that when the op originally asked, he was also only setting the 'user' and 'group' bits, and not other?
    – phemmer
    Commented Oct 18, 2014 at 23:30

1 Answer 1

2

Colors

The coloring is controlled by the DIR_COLORS* files that reside under `/etc. For example on Fedora 19 I have the following 3 files:

$ ls -l /etc/DIR_COLORS*
-rw-r--r--. 1 root root 5004 Jan 20  2014 /etc/DIR_COLORS
-rw-r--r--. 1 root root 5682 Jan 20  2014 /etc/DIR_COLORS.256color
-rw-r--r--. 1 root root 4646 Jan 20  2014 /etc/DIR_COLORS.lightbgcolor

The coloring is completely cosmetic and keys off of the output that ls is generating. You can disable it like so:

$ ls --color=never <other options>

The DIR_COLORS* files can be viewed, they're just text, and have decent commenting, explaining their functionality. This line is why it's displaying as green:

OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky

Executable directories

Directories need to be executable so that user's can cd into them and run commands. Without that bit, the directories cannot be accessed.

$ mkdir adir
$ chmod 644 adir
$ cd adir
bash: cd: adir: Permission denied

The reasons behind this are already extensively discussed in this other U&L Q&A titled: Execute vs Read bit. How do directory permissions in Linux work?.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .