Re: deny deleting a file for users

From: Brian Hatch (focus-linux_at_ifokr.org)
Date: 06/02/03

  • Next message: Devdas Bhagat: "Re: deny deleting a file for users"
    Date: Mon, 2 Jun 2003 09:57:31 -0700
    To: J Norfleet <jnorfleet@picusnet.com>
    
    
    

    > > However this is a horrible kludge. I suggest that you take good backups
    > > and make them available to the users who delete their files by mistake.
    > > Or, let them feel the pain a few times until they stop doing it.
    >
    > Create hard links. (Backup copy that changes when the original files do.)

    For normal files, I'd suggest this. However since it's a mail spool
    the poster was worried about, I imagine that the software uses the
    standard 'open new file, write out emails that we still want, remove
    original, rename new file to old file name' method. Using a hardlink
    to the original you will have a good copy of today's mail spool,
    but it'll be the exact same file months/years later because the real
    mail spool keeps being recreated.

    Now if that's not the case (say the program writes a temp file and
    then writes the temp file back over the original file, such that the
    original file inode has never changed) then using hardlinks will be
    an excellent solution.

    --
    Brian Hatch                  How to generate a sendmail.cf:
       Systems and                1) pick up phone while using modem
       Security Engineer          2) sneeze into phone
    http://www.ifokr.org/bri/     3) copy resulting line noise to
                                     /etc/sendmail.cf
    Every message PGP signed
    
    



  • Next message: Devdas Bhagat: "Re: deny deleting a file for users"

    Relevant Pages

    • Re: Modifying a file w/o creating a temp file
      ... ease of use, if the original file had hard links to it, they are ... space equal to the size of the temp file (unless the temp file is ... written to a different file system which raises its own issues). ... lost the file entirely. ...
      (comp.lang.java.programmer)
    • Re: Modifying a file w/o creating a temp file
      ... Of course there's one simple and obvious solution which has not yet been mentioned or rejected: read the whole file into memory, modify it there, truncate the original file, and write the modified data into it. ... This has substantial subtle benefits, balanced against the one flaw of being memory hungry and limited by swap space. ... Benefits include ease of use, if the original file had hard links to it, they are not broken, if it had special modes/attributes/ACLs, they are not lost, and it never needs more space than the file system has, whereas a temp-file solution typically needs an amount of unused disk space equal to the size of the temp file. ...
      (comp.lang.java.programmer)
    • Re: fopen: pre-pending text
      ... >> 2) open a temp file for writing ... >> 4) write original file to end of temp file ... >right after verifiying. ... >> 8) open original file for writing at start of file ...
      (comp.os.linux.development.system)
    • Re: FSUTIL, hardlink not working
      ... echo Viva l'Italia! ... create hard link to the original file ... test content of the original file; if content is updated, hardlink is ... I created a batch file for you that shows how the hardlink ...
      (microsoft.public.win2000.file_system)
    • Re: File manipulation
      ... >> I'm getting confused on the login. ... one easy way to do that is to use a temp file: ... > * open original file ... > * move the temp file over the original file ...
      (perl.beginners)