LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Do you have to have execute on a directory to be able to view contents in it? (https://www.linuxquestions.org/questions/linux-newbie-8/do-you-have-to-have-execute-on-a-directory-to-be-able-to-view-contents-in-it-4175535779/)

sigint-ninja 03-04-2015 05:58 PM

Do you have to have execute on a directory to be able to view contents in it?
 
hi guys im a little confused

read privilege on a directory means i can list the contents
write means i can save,edit and delete files in that directory
but then it says execute is like a light switch,if its off (no execute) you will not be able to view items in the directory

so do you have to have rwx on a directory to be able to use it fully?
if you have rw- as the owner will you not be able to view or change
into subdirectories within that directory?

dugan 03-04-2015 06:05 PM

Yes

astrogeek 03-04-2015 06:29 PM

Yes. Although it occupies the 'execute' bit location and is shown as 'x' in most listing tools, it is not actually 'execute' in directory context.

Think about it - you cannot 'execute' a directory - it must mean something else!

It is often called the 'traversal' or 'cross' bit in some Unix texts - cross fitting well with the 'x' symbol.

What it means is that you can read meta data from within the directory, effectively meaning that you can traverse, or cross the directory boundary.

But alas, everyone does still call it the execute bit.

Miati 03-04-2015 07:01 PM

I perceive it to be execute because directories are a special kind of file, but a file still.
the execute permits executing of code which is likely nothing more then pointing names to inode locations

Could be I'm way off, but it helps me to understand :P

Fred Caro 03-04-2015 07:56 PM

I look at it this way, to open a directory you have to 'execute' it and so you have performed an action on it but you have n't writen to it because this inode/file is just a container.

Fred.

veerain 03-04-2015 11:45 PM

Quote:

Originally Posted by sigint-ninja (Post 5327025)
hi guys im a little confused

read privilege on a directory means i can list the contents
write means i can save,edit and delete files in that directory
but then it says execute is like a light switch,if its off (no execute) you will not be able to view items in the directory

so do you have to have rwx on a directory to be able to use it fully?
if you have rw- as the owner will you not be able to view or change
into subdirectories within that directory?

If you remove execute perm but still have read perm on dir then you can't get file metadata content. But you can list the names of all files present in it.

sigint-ninja 03-05-2015 02:16 PM

as always, thanks guys...


All times are GMT -5. The time now is 10:35 PM.