aspose file tools*
The moose likes Linux / UNIX and the fly likes question about Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "question about "ls -l" resultd" Watch "question about "ls -l" resultd" New topic
Author

question about "ls -l" resultd

Raj Ohadi
Ranch Hand

Joined: Jun 30, 2006
Posts: 316
if I have /home/mydir/sample/ direcory and inside this dir I have some files.

First I do "cd /home/mydir/" then do "ls -l", I see

drwxrw-r-- 2 abcde XYZ 1000 Jun 3 09:09 sample
....

which means for "sample" directory, the owner is "abcde" and group is "XYZ".

then I do "cd sample" followed by another "ls -l" I see

-rw-r--r-- 1 abcde OPQ 600 Sep 30 08:08 data1
-rw-r--r-- 1 abcde OPQ 700 Sep 30 09:08 data2
...

which means for these files (data1, data2) under the "sample" folder, the owner is still "abcde" but the group is "OPQ".

How does this make sense ? So, for a user belonging to group "XYZ", he can't read the files under "sample" folder ? But "XYZ" has the "read" priviledge to the "sample" folder so theie members are supposed to read things under this folder, correct ?

Similarly, for a user in "OPQ" group, they should be able to read "data1" file, but why can he do that while he doesn't belong to "XYZ" group at all (which menas he is blocked from the "sample" directory) ?

Why do we often seen such setting in UNIX ?
Scott Johnson
Ranch Hand

Joined: Aug 24, 2005
Posts: 518

So, for a user belonging to group "XYZ", he can't read the files under "sample" folder ?


No. The file and directory permissions for others is read-only. So any user can view the files.

Similarly, for a user in "OPQ" group, they should be able to read "data1" file, but why can he do that while he doesn't belong to "XYZ" group at all


A user can belong to multiple groups. Also, there is nothing blocking users from the directory -- everyone has read access to the directory. Group and Other don't have "x" permission on the directory which mean they can't enumerate the files in the directory. But if given the file name, they can read the file.
[ November 27, 2006: Message edited by: Scott Johnson ]
 
Consider Paul's rocket mass heater.
 
subject: question about "ls -l" resultd