[plug] rmdir problems
Russell Steicke
r.steicke at bom.gov.au
Sat Feb 5 19:26:10 WST 2005
On Sat, Feb 05, 2005 at 07:06:53PM +0800, Arie Hol wrote:
>
>
> On 5 Feb 2005 at 18:08, Joong Cho wrote:
>
> > Hello,
> >
> > I was wondering why linux won't remove a directory when the directory is in
> > fact empty. I've had this problems before. Is it something to do with file
> > permissions or something etc?
> >
>
> You may have answered your own question, re: "permissions"
>
> Check who owns the directory - switch to that user if necessary - change the permissions and/or
> remove the directory.
It's actually unimportant who owns the directory, but important who
owns its parent directory. For instance:
cd
mkdir footemp
sudo chown root footemp
rmdir footemp
will succeed if you are a non-root user with sudo permission.
So check the ownership of the parent directory. The reason this works
is that deleting something (any entity in the file system) just
removes (unlink()s) the entry from the parent directory. When the
link count goes to zero, the entity is removed from the file system.
You need write permission in the containing directory to remove
anything.
So, do this:
ls -al diriwanttoremove
and check the owner and permissions of the .. entry.
Also, it would have been better if you (Joong) had cut-n-pasted the
error message, or mentioned that there wasn't an error message.
--
Russell Steicke
-- Fortune says:
Contemptuous lights flashed across the computer's console.
-- Hitchhiker's Guide to the Galaxy
More information about the plug
mailing list