I was going through my old code and I stumbled upon some strange behaviour.

Folder and files inside it are chowned to me, however I am not allowed to enter it,
or even list its content. Unless ofcource I am a root user.

Here is a screenshot. Could you please explain ? file listing allowed when sudo, but not to regular user

GNU coreutils : 8.25,
OS : Ubuntu 16.04.2 LTS


Directories must have executable bit set to be "searchable". That includes listing contents as well as entering them with cd. Try chmod +x on the Scripts dir, for example. This is different from regular files where executable bit allows them to be executed (of course).

More information here: Execute vs Read bit. How do directory permissions in Linux work? and In Linux, "Write" Permission Is Equivalent To "Execute" For Directories?

| improve this answer | |
  • Thank you very much, I didn't know that. But why is it so can you explain I didn't understand why +x required for cd. – prashant Jul 2 '17 at 5:01
  • Sure. I added some links to my answer that go into this. Lots of other people have been thrown off by this behavior. But it makes sense once you get used to it. – B Layer Jul 2 '17 at 5:09

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