PDA

View Full Version : How do I make a file modifiable but not deletable?




Kyle Nerder
Jan 26, 2007, 01:31 PM
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?



mkrishnan
Jan 26, 2007, 01:36 PM
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?

Kyle Nerder
Jan 26, 2007, 01:41 PM
Perhaps you have to look at an option to automate backup of the file instead?

I don't think my co-workers could handle doing a simple back up each time.... But thanks!

SilentPanda
Jan 26, 2007, 01:44 PM
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.

mkrishnan
Jan 26, 2007, 01:55 PM
I don't think my co-workers could handle doing a simple back up each time.... But thanks!

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.... :)

emptyCup
Jan 26, 2007, 04:13 PM
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 (http://arstechnica.com/reviews/os/macosx-10.4.ars/8).

N10248
Jan 26, 2007, 04:20 PM
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.

MisterMe
Jan 26, 2007, 05:58 PM
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.

...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.

MarkCollette
Jan 26, 2007, 06:34 PM
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.