The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: ron@ronnatalie.com (Ron Natalie)
Subject: [TUHS] can't protect files from deletion v5,v6, or v7
Date: Wed, 24 May 2017 20:57:00 -0400	[thread overview]
Message-ID: <021401d2d4f1$d1b89ef0$7529dcd0$@ronnatalie.com> (raw)
In-Reply-To: <CAEoi9W59e5sZe2xLfTV2zT_PEuXJPdvym3R2J2qQ5H9YYWS1_g@mail.gmail.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1051 bytes --]

You have to understand that you can’t directly delete a file in UNIX.   It’s never worked that way.

What you can do is remove the directory reference (in UNIX terms, a link) to the file.   When the link count goes to zero, the inode (which embodies the storage and permissions, etc..) of the file then gets freed up (along with the data blocks comprising the file).

 

The inode permissions of the file have NEVER had any bearing on whether it can be unlinked or not.   The permission to unlink is that of the directory that contains it.   If the directory is writable, the file can be unlinked from that directory.   If that’s the last link, the file goes away.

 

RM in many versions checks to see if the file is read only and asks if you are sure, but that is an artificial safety net done by the rm program (which is not present in the unlink system call itself).

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20170524/c41748ff/attachment.html>


  reply	other threads:[~2017-05-25  0:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-25  0:23 Mark Longridge
2017-05-25  0:28 ` Christian Groessler
2017-05-25  0:48 ` Dan Cross
2017-05-25  0:57   ` Ron Natalie [this message]
2017-05-25  1:36 ` Dave Horsfall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='021401d2d4f1$d1b89ef0$7529dcd0$@ronnatalie.com' \
    --to=ron@ronnatalie.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).