LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-15-2009, 07:53 AM   #1
bhaslinux
Member
 
Registered: Oct 2003
Location: UnitedKingdom
Distribution: Debian Lenny
Posts: 351

Rep: Reputation: 47
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
 
Old 04-15-2009, 08:13 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
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.
 
Old 04-15-2009, 08:38 AM   #3
bhaslinux
Member
 
Registered: Oct 2003
Location: UnitedKingdom
Distribution: Debian Lenny
Posts: 351

Original Poster
Rep: Reputation: 47
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 ?
 
Old 04-15-2009, 08:45 AM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
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.....
 
Old 04-15-2009, 09:08 AM   #5
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
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.

Last edited by colucix; 04-15-2009 at 09:14 AM.
 
Old 04-15-2009, 10:03 AM   #6
rajeshdogra
LQ Newbie
 
Registered: Jul 2005
Location: Delhi,India
Distribution: RHEL, UBUNTU
Posts: 19

Rep: Reputation: 0
Thumbs up

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 . 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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Basic I/O Redirection Differences In Sh/Ksh, Bash and Zsh On Linux And Unix LXer Syndicated Linux News 0 07-04-2008 05:51 AM
LXer: Basic Installation Security Guidelines For Linux and Unix - Part 1a LXer Syndicated Linux News 0 06-19-2008 05:51 AM
Basic Question Unix (Groups) tostay2003 Linux - Software 2 08-16-2006 01:02 PM
Basic commands in unix/linux sathish80 Linux - Newbie 5 03-24-2006 02:45 PM
Basic Unix Program for Linux Daniel Programming 10 07-05-2001 01:17 PM


All times are GMT -5. The time now is 12:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration