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"

  • 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 8:12
  • can you cd to those dir as normal user ? I guess no, x is needed for that. – Archemar Sep 25 '14 at 8: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 8: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 8: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 8:18

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 8: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 8:22

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