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

Re: rm files owned by root?

On Wed, Dec 29, 2004 at 08:22:08PM +0100, dekkker wrote:
> It asks if I want to remove this file, since it's write protected. If I
> say "y", then the file gets deleted. But it shouldn't be! Should it? 

As the others have said, this behaviour is to be expected.

If your filesystem is ext2 or ext3, you can achieve what you want by using
"chattr" as root to set the file's "immutable" bit. According to the

  A file with the `i' attribute cannot be modified: it cannot be deleted or
  renamed, no link can be created to this file and no data can be written
  to the file.  Only the superuser or a process possessing the
  CAP_LINUX_IMMUTABLE capability can set or clear this attribute.

Is something similar also available for other filing systems?



  __   _
  |_) /|  Richard Atterer     |  GnuPG key:
  | \/¯|  http://atterer.net  |  0x888354F7
  ¯ '` ¯

Reply to: