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?

  • why do you want to make a directory executable? that seems to pose a HUGE security risk – jgr208 Oct 18 '14 at 23:21
  • I'm playing around with permissions, trying to figure out the implications. – danihodovic Oct 18 '14 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 Oct 18 '14 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. – Patrick Oct 18 '14 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? – Patrick Oct 18 '14 at 23:30
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?.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.