How do I make a file modifiable but not deletable?

Discussion in 'macOS' started by Kyle Nerder, Jan 26, 2007.

  1. Kyle Nerder macrumors regular

    Kyle Nerder

    Joined:
    Oct 14, 2005
    Location:
    Toronto
    #1
    Hey,

    This might be considered an odd question, but I was wondering if there was a way to make a file modifiable, but not deletable.

    At our office there is a excel file we all need to access to read and modify, but I am afriad someone relocating or placing it in the trash...

    Any words of advice?
     
  2. mkrishnan Moderator emeritus

    mkrishnan

    Joined:
    Jan 9, 2004
    Location:
    Grand Rapids, MI, USA
    #2
    Mmm...that's a toughie. I don't know any easy way to do that. As far as I know, with Unix file permissions, write permissions are an all/nothing proposition -- you can either modify the file as you please, including deleting it, or you cannot modify it at all. Perhaps you have to look at an option to automate backup of the file instead?
     
  3. Kyle Nerder thread starter macrumors regular

    Kyle Nerder

    Joined:
    Oct 14, 2005
    Location:
    Toronto
    #3
    I don't think my co-workers could handle doing a simple back up each time.... But thanks!
     
  4. SilentPanda Moderator emeritus

    SilentPanda

    Joined:
    Oct 8, 2002
    Location:
    The Bamboo Forest
    #4
    There really isn't a way aside from backing it up or putting it in a source control program. If somebody can edit it, they can delete the file on any system I've heard of. Even if they couldn't delete the file they could delete all the contents.
     
  5. mkrishnan Moderator emeritus

    mkrishnan

    Joined:
    Jan 9, 2004
    Location:
    Grand Rapids, MI, USA
    #5
    I'm not saying that you should make them back it up. ;) That would be too lazy! :p

    This file lives on a server, where everyone is accessing the same file, right? Or else it lives on one single computer that people walk up to?

    I'm saying that you should make a cron script on the computer that owns the file and use the cron script to make backups. Shouldn't take more than 10-15 minutes to make and implement a script that saves backups periodically.... :)
     
  6. emptyCup macrumors 65816

    emptyCup

    Joined:
    Jan 5, 2005
    #6
    Unix permissions give anybody with Write access Delete privileges. To do what you want to do you need to use Access Control Lists. There is more information about it here.
     
  7. N10248 macrumors 6502a

    N10248

    Joined:
    Jun 11, 2004
    Location:
    Essex, U.K.
    #7
    You could hide the original file in a hidden folder and make an alias point to it, then if the alias was deleted the orignal file would still be there.

    It would also not be visible in the finder so draging it to the bin or Cmd+Delete would not work either.
     
  8. MisterMe macrumors G4

    MisterMe

    Joined:
    Jul 17, 2002
    Location:
    USA
    #8
    When you save a modified file, you necessarily delete the old version and replace it with the new. SilentPanda is correct. You need a version control system which will allow you to access any and all previous versions of your files.
     
  9. MarkCollette macrumors 68000

    MarkCollette

    Joined:
    Mar 6, 2003
    Location:
    Calgary, Canada
    #9
    Using UNIX file permissions, what you can do is take away write permission from the directory that contains the file. But then, you also can't make new files in that directory. Also, as SilentPanda said, if the user can modify the file, then they can always truncate it, which means that the file remains, but it's empty.

    Using Access Control Lists, on some systems, you could set that file to be Appendable/Readable/Not Writable/Not Deletable. That would mean the user could only add to the file, and read it, but not remove existing information or delete the file.
     

Share This Page