LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   basic unix (linux) question ... (https://www.linuxquestions.org/questions/linux-newbie-8/basic-unix-linux-question-719271/)

bhaslinux 04-15-2009 06:53 AM

basic unix (linux) question ...
 
Hi,
consider these operations.

$ mkdir y
$ ls -ld y
drwxrwxr-x 2 user user 4096 2009-04-15 12:51 y
$ chmod 077 y
$ ls -ld y
d---rwxrwx 2 user user 4096 2009-04-15 12:51 y
$ id
uid=1001(user) gid=1001(user)
$ cd y
bash: cd: y: Permission denied



why is permission denied ?
I may not have permissions to enter dir as owner but still belong to group 'user' which has
permissions to enter the directory

pixellany 04-15-2009 07:13 AM

Same result on my system....

Never thought about this before, but the inference is that "permission denied" for the owner trumps "permission granted" for the user group. I switched to a different user and confirmed that I could cd into the directory.

bhaslinux 04-15-2009 07:38 AM

yep
so does this mean that we are breaking the good old unix standards ? as day-by-day we sophesticate things ?
is this supposed to behave this way ?

pixellany 04-15-2009 07:45 AM

I would guess that this is in fact the way Unix works---I don't know why any version of Linux, Gnu, whatever would want to change such a fundamental thing.

If you are terminally curious, install OpenBSD or OpenSolaris and check the behavior........or give Uncle Google a shot.....;)

colucix 04-15-2009 08:08 AM

In my little knowledge of the *nix internals, you cannot access a directory if it has not the executable bit. Since the permissions for the group are still rwx, other users can descend into the directory.

Also note that if you set the executable bit, but not the read bit
Code:

$ chmod 177 testdir
$ ls -ld testdir
d--xrwxrwx 2 colucix users 4096 Apr 15 15:10 testdir
$ cd testdir
$ pwd
/home/colucix/testdir
$ ls
ls: .: Permission denied

you can cd into it, but you cannot list its content.

rajeshdogra 04-15-2009 09:03 AM

This simply implies that the permissions applied for a specific user overrides others such as Group and Other.

Quote:

Hi,
consider these operations.

$ mkdir y
$ ls -ld y
drwxrwxr-x 2 user user 4096 2009-04-15 12:51 y
$ chmod 077 y
$ ls -ld y
d---rwxrwx 2 user user 4096 2009-04-15 12:51 y
$ id
uid=1001(user) gid=1001(user)
$ cd y
bash: cd: y: Permission denied
This is my understanding for the your finding above :scratch:. It can be taken as a positive security measure since there are limitations attached to every design. And I feel just to address these type of complex requirements SUID/SGID have also been deesigned. :study:


All times are GMT -5. The time now is 04:13 PM.