Re: [SLUG] confused about file permissions

From: Ian C. Blenke (icblenke@nks.net)
Date: Sat Oct 29 2005 - 22:07:07 EDT


Eben King wrote:
> On Sat, 29 Oct 2005, Sick Twist wrote:
>
>
>>> From: "Ian C. Blenke" <ian@blenke.com>
>>> Reply-To: slug@nks.net
>>> To: slug@nks.net
>>> Subject: Re: [SLUG] confused about file permissions
>>> Date: Sat, 29 Oct 2005 19:55:07 -0400
>>>
>>> <snipation>
>>> Confused yet? ;)
>>>
>>> - Ian C. Blenke <ian@blenke.com> http://ian.blenke.com/
>>>
>> Just to clarify: In order to delete empty directory "foo", I only need write
>> access to foo's parent directory--correct?
>>
>
> No, you need execute permission as well:
>
> [eben@pc tmp]$ ls -l 1
> total 4.0K
> 4.0K d--------- 2 root root 4.0K Oct 29 20:37 foo/
> [eben@pc tmp]$ chmod 200 1
> [eben@pc tmp]$ ls -ld 1
> 4.0K d-w------- 3 eben eben 4.0K Oct 29 20:37 1/
> [eben@pc tmp]$ rmdir 1/foo
> rmdir: `1/foo': Permission denied
> [eben@pc tmp]$ chmod 100 1
> [eben@pc tmp]$ ls -ld 1
> 4.0K d--x------ 3 eben eben 4.0K Oct 29 20:45 1/
> [eben@pc tmp]$ rmdir 1/foo
> rmdir: `1/foo': Permission denied
> [eben@pc tmp]$ chmod 300 1
> [eben@pc tmp]$ ls -ld 1
> 4.0K d-wx------ 3 eben eben 4.0K Oct 29 20:37 1/
> [eben@pc tmp]$ rmdir 1/foo
> [eben@pc tmp]$
>
> Haven't got a handle on _why_ yet...
>
>
Google for an answer for this, and you find Wayne Pollock's page on Unix
permissions as the third hit for "unix directory permissions" (hi wayne!)

    http://www.hccfl.edu/pollock/AUnix1/FilePermissions.htm

"Besides controlling a user's ability to |cd| into some directory, the
execute permission is required on a directory to use the |stat()| system
call on files within that directory. The |stat()| system called is used
to access the information in a file's |inode|, and must be done before
you can open or delete (via the |unlink()| system call) that file. "

That's kind of what it "felt" like while testing your example. If you
learned your Unix programming back in the day, this was different on
varying Unix flavors.

- Ian C. Blenke <ian@blenke.com> http://ian.blenke.com

-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 18:59:09 EDT