[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Kernel 3.14.x bug? rm, mv root-owned files



Ahoj,

Dňa Fri, 06 Jun 2014 09:42:19 -0400 The Wanderer <wanderer@fastmail.fm>
napísal:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512
> 
> On 06/05/2014 11:37 PM, Bob Proulx wrote:
> 
> > jimmy wrote:
> 
> >>    // --- remove (delete) a file owned by root, should not be
> >> allowed, but is allowed.  Here, it says the file is 'read-only'
> >> so it warns about it, but of course "rm -f " would work, too:
> > 
> > Why do you think it should not be allowed?  It is allowed.
> > 
> > If you don't want a user to modify the directory then change the
> > permissions of the directory.
> 
> In this case, however, the user isn't just modifying the directory;
> the user is modifying a file in the directory, by deleting that file.

I understand your confusion. I was confused by the same way a lot years
ago, when i come from Windows, where the RO attribute disallows to
delete the file.

You need to consider, that in Linux (or more precise, on Unix based
systems) all is a file, where on filesystem:

- file has its content and attributes
- directory has it content and attributes too (because it is a file)

(The attributes here are in mean access/modify times and access rights)

The content of the file are file's bytes, e.g. letters in text file.
But not the file itself. The file itself is nothing other, than pointer
to place on the storage device (simplified) and this pointer is a
content of the correspondent directory (where file is placed).

You need to know, that the deleting of the file is not removing the
bytes from storage, but only removing this pointer from directory.

By things mentioned above, access right allow or not allow (beside
others) to access/modify the content of the file and/or modify
the content of the directory (remember you? - it is a file too).
Deleting the file is removing pointer to it from it's correspondent
directory, thus modifying the content of the directory, because
directory's file (pointer to place on the disk) is a part of the
directory, not a file of itself, then not file's rights are here in the
play but the directory's rights.

regards

-- 
Slavko
http://slavino.sk

Attachment: signature.asc
Description: PGP signature


Reply to: