10

I just copied a directory from a USB flash drive. I copied it from an NTFS drive and so all the files had execute permission.

I executed chmod -x * to undo the execute permission. Despite that, all the directories are showing with green background, which is normally only for executable files.

What could be the reason?

Attached image: output of "ls -al"

einpoklum
  • 9,515
Stark07
  • 572
  • 2
  • 8
  • 20
  • A directory that isn't executable can't have its contents listed properly - this probably isn't what you want. – Michael Homer Sep 25 '14 at 08:12
  • can you cd to those dir as normal user ? I guess no, x is needed for that. – Archemar Sep 25 '14 at 08:13
  • @Archemar - I can cd to those commands, but when i do, . and .. show up with green background as well. – Stark07 Sep 25 '14 at 08:16
  • @MichaelHomer - I have gone through it, and in my case there are no special permission associated either. Also, I went through the answers on that question and my query is not satisfied. – Stark07 Sep 25 '14 at 08:16
  • Try reading the first (accepted) answer in the duplicate: "Blue text with green background indicates that a directory is writable by others apart from the owning user and group, and does not have the sticky bit set". That is exactly what you have. – Michael Homer Sep 25 '14 at 08:18
  • @MichaelHomer - ok. my bad. I googled a bit more on that answer and it makes sense. Thanks. – Stark07 Sep 25 '14 at 08:20
  • @MichaelHomer it isn't exactly what we have here. The question to which this is linked as dup is about the background colour, this one is about permissions. Both are very related to each other but deserves separate answers/solutions. – jangorecki Mar 21 '16 at 20:58

1 Answers1

16

A green background means that the directory has write permission for others, not that it is traversible. Remove these privileges instead:

chmod o-rw *
  • 1
    Thanks, that worked! Can you please elaborate your answer a bit? I didn't quite understand the reason. – Stark07 Sep 25 '14 at 08:17
  • 1
    Each file or directory has three classes of access control: "user", "group", and "others" (which matches anyone who's not the owner of the file or a member of the group); each one can have a read/write/execute privileges. Directories which are writable by "others" appear (by default) on a green background. – Jean-Karim Bockstael Sep 25 '14 at 08:22