Re: difference between read permission and executing permission

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Sep 12, 2010 at 9:07 PM, Parmenides <mobile.parmenides@xxxxxxxxx> wrote:
> 2010/9/12 Mulyadi Santosa <mulyadi.santosa@xxxxxxxxx>:
>> On Sun, Sep 12, 2010 at 00:28, Parmenides <mobile.parmenides@xxxxxxxxx> wrote:
>>> Hi,
>>>
>>>   For a specified directory, we can go through it when the kernel
>>> parsing path, though we can not read it. Actually, parsing path also
>>> need read the directory file. So, how does the kernel distinguish
>>> between these two permission?
>>
> Sorry for replying so late due to some trifles. For a directory, if it
> is allowed to read, that means we can list all items in its directory
> file, namely that we can read it completely.

May be I understood the question wrong.... but you can't "ls" in a
directory if it doesn't have execute permission. Or rather even if a
directory has read/exectue permission you can't ls on it till all the
directories in its path have execute permission. Is there something
else that you are asking ?

/home/mkatiyar/codetree/main> cd /tmp
/tmp> mkdir -p a/b/c/d
/tmp> ls -lR a
a:
total 4
drwxr-xr-x 3 mkatiyar mkatiyar 4096 2010-09-12 22:26 b

a/b:
total 4
drwxr-xr-x 3 mkatiyar mkatiyar 4096 2010-09-12 22:26 c

a/b/c:
total 4
drwxr-xr-x 2 mkatiyar mkatiyar 4096 2010-09-12 22:26 d

a/b/c/d:
total 0
/tmp> chmod 000 a/b
/tmp> ls -lR a
a:
total 4
d--------- 3 mkatiyar mkatiyar 4096 2010-09-12 22:26 b
ls: cannot open directory a/b: Permission denied
/tmp> cd a/b
ksh: cd: a/b: [Permission denied]
/tmp> ls a/b
ls: cannot open directory a/b: Permission denied


> If it is allowed to
> execute, that means we can go through it in a process of path parsing.
> Path parsing will open every directory in a specified path. For
> example, when parsing a path like /home/parmenides/src/hello.c, the
> kernel will open a sequence of directory files, namely /, /home,
> /home/parmenides and /home/parmenides/src, and read its subdirectory
> for each. So, both of read permission and executing permission mean
> that the kernel need to read the corresponding directory file. As
> such, the common 'readable' has two meanings for a directory. One
> corresponds to read the directory file when listing it, the other
> corresponds to read the directory file when paring path.
>
> On the other hand, system call opendir(const char *pathname) has no
> way to distinguish these two meanings whereas both listing and path
> parsing need call opendir(). My quesition is exactly that how these
> two permissions take their effect.
>
> --
> To unsubscribe from this list: send an email with
> "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
> Please read the FAQ at http://kernelnewbies.org/FAQ
>
>



-- 
Thanks -
Manish
==================================
[$\*.^ -- I miss being one of them
==================================

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux