The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Awk - to test multiple files "read" permission ? lokiman Shell Programming and Scripting 1 02-09-2008 09:10 AM
ls while read loop - internal read picking up wrong input dkieran Shell Programming and Scripting 2 05-14-2007 12:02 PM
Permission file questions--Please read!!! bobo UNIX for Dummies Questions & Answers 4 02-10-2007 08:03 PM
Read Permission vineetrocks2005 UNIX for Dummies Questions & Answers 9 05-22-2006 11:00 AM
read line and read next ariuscy UNIX for Dummies Questions & Answers 7 09-21-2005 04:04 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 04-23-2004
flim flam flamma jamma
 

Join Date: May 2001
Location: Chicago IL, USA
Posts: 1,006
read permission but cant ls -l it.

ok what is the signifigance of the -l that wont let you list the contents of a directory you clearly have access to list files. what am i missing


Code:
[qgatu003]/tmp$ls -l hold
hold/file1: Permission denied
total 0

[qgatu003]/tmp$ls hold
file1

[qgatu003]/tmp$ls -l
dr-x---r--   2 root     other        179 Apr 23 09:18 hold

edit::

i want to say its because i can not read the inode information from the file. does the system need to pull you to the files current directory in order to gets its full list of required arguments?......

Last edited by Optimus_P; 04-23-2004 at 08:03 AM.
Reply With Quote
Forum Sponsor
  #2  
Old 04-23-2004
RTM's Avatar
RTM RTM is offline
Hog Hunter
 
Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
You don't have access to the directory unix to list file attributes.

chmod 505 unix
and then a normal user would be able to ls -l unix and see the file1 ( even if file1 has -r--------- with owner root)
Reply With Quote
  #3  
Old 04-23-2004
flim flam flamma jamma
 

Join Date: May 2001
Location: Chicago IL, USA
Posts: 1,006
yeah i know if i add o+x i can list it. but why do you need to be able to enter the directory in order to read its contents is what i am trying to get at.

mabey i am not seeing the big picture or something but if you have read permission on a directory you should be able to list the file in all forms. apparently you need to be able to enter the directory to beable to read its inode information .... which i dont understand as to why.
Reply With Quote
  #4  
Old 04-23-2004
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,609
Instead of x meaning search, think of it as "use" a directory.

With r permission only, you can list the files in a directory but you can't open them or stat them. And you can't cd to the directory either. The directory is reduced to being just a list filenames. It has sorta lost the special status that directories have.

With x permission only, you can cd to a directory but you can't list the files. If you happen to know a filename, you can open (file permissions allowing) or stat that file.

By the way, stat'ing a file is required for ls -l. stat'ing a file is also how "ls" gets an inode number. So "ls -i" needs x permission as well.

I don't think it makes sense to give a user just r or x on a directory. With me, it's always both or none.
Reply With Quote
  #5  
Old 04-23-2004
flim flam flamma jamma
 

Join Date: May 2001
Location: Chicago IL, USA
Posts: 1,006
504 perms you can do everything except (useing the command ls):
-R
-l
-n
-o
-g
-t
-p
-F
-s

which is kinda why i brought it up.

i mean you obvestly i can get some info from the filesystem abou the file but I cant read the inode info.

i can accept you need r-x to list files and its attributes.
but its i want to understand why i have to accept it.
Reply With Quote
  #6  
Old 04-23-2004
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,609
I assume that this a directory that you don't own so that you are relying the 4 of 504.

The reason is that the stat system call is not working. Remember that a directory is just a list of filenames and inode numbers. Until you stat the the file, there is no way to know its size, owner, group, etc.

Why do you have to accept it? I guess you don't. But besides accepting it, what other choices do you see? Switch to another OS? Rewrite the kernel? Lobby for a change? Personally, I'd just live with it...
Reply With Quote
  #7  
Old 04-23-2004
flim flam flamma jamma
 

Join Date: May 2001
Location: Chicago IL, USA
Posts: 1,006
well... i do own it cuz i am the admin but i was just doing an exersize and came across it.

well after reading the man page for stat it just planly layes it out. You need to be able to use/execute the directory in order for the stat function to work.

Code:
DESCRIPTION
     The stat()  function  obtains  information  about  the  file
     pointed  to  by  path. Read, write, or execute permission of
     the named file is not required, but all  directories  listed
     in the path name leading to the file must be searchable.
as far as accepting it. why accept anything because someone says so. shouldnt you always question something to find out how it works. ie: dont blindly accept
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 08:57 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0