Re: difference between read permission and executing permission

2010-09-12 Thread Manish Katiyar
On Sun, Sep 12, 2010 at 9:07 PM, Parmenides  wrote:
> 2010/9/12 Mulyadi Santosa :
>> On Sun, Sep 12, 2010 at 00:28, Parmenides  
>> 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 ecar...@nl.linux.org
> 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 ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ



Re: difference between read permission and executing permission

2010-09-12 Thread Parmenides
2010/9/12 Mulyadi Santosa :
> On Sun, Sep 12, 2010 at 00:28, Parmenides  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. 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 ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ



Re: difference between read permission and executing permission

2010-09-12 Thread Bond
On Sat, Sep 11, 2010 at 10:58 PM, Parmenides wrote:

> Hi,
>
>   For a specified directory, we can go through it when the kernel
> parsing path, though we can not read it.

Hi can you be a bit more elaborate on this part I am also trying to
understand what you asked.


Re: difference between read permission and executing permission

2010-09-11 Thread mohit verma
mulyadi,
 i am not poking at  you. but i think if  we  go through namei.c   file as i
said ,things will be clear.


Re: difference between read permission and executing permission

2010-09-11 Thread Mulyadi Santosa
On Sun, Sep 12, 2010 at 00:28, Parmenides  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?


I find your question a bit confusing, sorry for that. But let me
guess, you mean, for example directory "blah" has permission
-wx--x--x. And you wonder, why it is readable (getting information
about it, inode etc) but we are unable to list the content?

Simple then, have you consider the permission of the directory which
contains "blah" directory? suppose it's "super_blah" and it has
rwxr-x-r-x, then of course we can read the information of "blah"
itself but unable to list the content of "blah" due to its own
permission.

Does it help?

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

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



difference between read permission and executing permission

2010-09-11 Thread Parmenides
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?

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