read permission but cant ls -l it.


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users read permission but cant ls -l it.
# 1  
Old 04-23-2004
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 12:03 PM..
# 2  
Old 04-23-2004
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)
# 3  
Old 04-23-2004
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.
# 4  
Old 04-23-2004
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.
# 5  
Old 04-23-2004
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.
# 6  
Old 04-23-2004
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...
# 7  
Old 04-23-2004
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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Checking if the directory has read and write permission

logMsg='Started by '${USER} LOG_MESSAGE "${logMsg}" resultCode=$? if ]; then return ${resultCode} fi touch ${FILELISTPATH} resultCode=$? if ]; then logMsg='failed to create file list:'${FILELISTPATH} LOG_ERROR "${logMsg}" CUSTOM_PREPROCESS ${FATAL} ... (2 Replies)
Discussion started by: raka123
2 Replies

2. Shell Programming and Scripting

Find list of files missing read & execute permission

Hi, I'm writing a post-upgrade script and I want to find which files don't have read and execute to everyone. I can run a find . ! -perm, but then I have to use a list of the possible permissions (777,775, 755 etc). Is there a more elegant solution? Thanks (2 Replies)
Discussion started by: Catullus
2 Replies

3. Solaris

Read Only Permission after the space is full.

Hi, Is there any chance that a file system that mounted on the server becomes read only when the space in that file system becomes full? Regards, Sreejith (9 Replies)
Discussion started by: Sreejith K
9 Replies

4. Ubuntu

how to make others have read/write permission when the aotu mounted usb flash disk pluge in ?

hi all: as we know , when usb flash disk plug in and aotu mounted , the default permission of the usb flash disk is 700. that means others have no permission . the question: how to make others have read/write permission when the aotu mounted usb flash disk pluge in ? thanks !! (0 Replies)
Discussion started by: arnold.king
0 Replies

5. Shell Programming and Scripting

perl script to check read/write/execute permission for 'others'

I want to check access rights permissions not for 'user', not for 'group', but for 'others'. I want to do it by system command in which i want to use 'ls -l' and 'awk' command. I have written the following program : #!/usr/bin/local/perl #include <stdlib.h> system ("ls -l | awk... (1 Reply)
Discussion started by: shubhamsachdeva
1 Replies

6. HP-UX

Lost Read permission on my folder

Hi I am a normal user on a HP-UX system which is meant for a large group. There are few directories which I think i am owner of. (Name of these directories is same as my username, and I usually have all the permissions in these directories). I was trying to give read and execute... (2 Replies)
Discussion started by: grvs
2 Replies

7. UNIX for Dummies Questions & Answers

CHMOD....read only permission

After creating a user account...how do i verify if theres only read access on the account. If not read access would i enter chmod a-xw "username"? (2 Replies)
Discussion started by: bigben1220
2 Replies

8. Shell Programming and Scripting

give permission to read a file

I want to give tester only the account tester to view the file /var/mail/root nobody else but him and of course the owner root w/o changing the permisions of /var/mail/root -rw-------. $ cat /var/mail/root cat: /var/mail/root: Permission denied (3 Replies)
Discussion started by: kenshinhimura
3 Replies

9. UNIX for Dummies Questions & Answers

Permission file questions--Please read!!!

1. I have an executable file that I have granted the users full permission "777" for it to work. I don't want the user to read this file! How can I prevent a user to read it? Thanks (4 Replies)
Discussion started by: bobo
4 Replies

10. UNIX for Dummies Questions & Answers

Read Permission

How can view the list of only those files & directories which have read permission..! (9 Replies)
Discussion started by: vineetrocks2005
9 Replies
Login or Register to Ask a Question