[mythtv-users] Is there a way to make a recording"Read-Only"-- "Protect" it from deletion

Marco Nelissen marcone at xs4all.nl
Thu Apr 13 05:33:25 UTC 2006


>>> That won't work. If you have write permissions to the directory, you
>>> can remove any file in it regardless of the file permissions.
>>>     
>>
>> That's why you'd set the "sticky" on that directory. That way only the
>> owner of a file will be able to delete it.
>>
>>   
>You're only mostly right about the no write privs on the file.  Yes if
>you have write privs on the directory you can still unlink the file but
>you need to use the -f option.  I don't know how Myth deletes files so
>it may do the equivalent of this.  An idea would be to change the
>ownership to root:root and mode 644.  See below:
>
>bhalter at excelsior ~ $ ls -l test.mpg
>-r--r--r--  1 bhalter root 9076672 Feb 11 12:31 test.mpg
>bhalter at excelsior ~ $ rm test.mpg
>rm: remove write-protected regular file `test.mpg'? n
>bhalter at excelsior ~ $ rm -f test.mpg
>bhalter at excelsior ~ $

That's why I said to use the sticky bit on the folder. With that set,
only the owner of the files can delete them.  /tmp is an example of a
folder that has the sticky bit set. Because of this, you can't delete
other people's files in /tmp, even though you have write privileges
in /tmp
In other words, if you were to set the sticky bit on the folder where
myth puts its recordings, then all you'd need to do to "write protect"
a recording is change its owner to someone else. You'd still be able
to play the recordings (since myth makes the files readable by anyone
by default), but you couldn't delete them. That's assuming that you
are not running myth as root, obviously, and also assuming that myth
doesn't get confused when you do try to delete the recording from
within myth.





More information about the mythtv-users mailing list