[plug] file options

Nima Talebi nima at it.net.au
Fri May 30 19:01:02 WST 2003


Excellent work. I owe you an ice cream. What flavour would you like? : )

Andrew Pamment wrote:

>I'm pretty sure it is possible using ext2 file attributes. from:
>
>http://www.tldp.org/HOWTO/mini/Ext2fs-Undeletion-2.html
>
>	On an ext2 file system, it is possible to use ext2 attributes to
>	protect things. These attributes are manipulated with the chattr
>	command. There is an `append-only' attribute: a file with this
>	attribute may be appended to, but may not be deleted, and the existing
>	contents of the file may not be overwritten. If a directory has this
>	attribute, any files or directories within it may be modified as
>	normal, but no files may be deleted. The `append-only' attribute 	is
>set with 
>
>
>	$ chattr +a FILE...
>
>I tested this out on my spare ext2fs partition, (it doesn't work with
>reiserfs and i don't know about ext3) I couldn't make it work because I
>don't have a program that i can think of that opens in append mode.. i
>had a look at nano and I am guessing it wants to write out the whole
>file again, and of course it wont let me because that would be modifying
>the existing contents..
>
>I think possibly this would be a good attribute to use for log files as
>I suspect they are opened in append mode, and a nasty evil computer
>criminal wanting to hide his tracks and doesn't know about chattr would
>be foiled.
>
>So, I'm pretty sure it *is* possible.. but you said proof and you'll buy
>me an ice cream.. ooh I need ice cream
>
>$ touch test.txt
>
>$ chattr +a test.txt
>
>$ nano
>
>*change the file*
>
>*save*
>
>nano reports "Operation not permitted"
>
>so I write a program.. 
>
>#include <stdio.h>
>
>int main (void ){
>        FILE *testfile;
>
>        testfile = fopen("test.txt", "a");
>
>        fprintf(testfile, "an appended line\n");
>
>        fclose(testfile);
>        return 0;
>}
>
>$ gcc program.c
>
>$ ./a.out
>
>$ cat test.txt
>an appended line
>$
>
>See.. it is possible.. can I have my ice cream now?
>
>Andrew
>
>
>On Fri, 2003-05-30 at 08:34, Nima Talebi wrote:
>  
>
>>ooh, _not delete what is already there_, you can't. If you prove me
>>wrong, I'll buy you an ice cream.
>>
>>Nima
>>
>>Craig Dyke wrote:
>>    
>>
>>>Howdy all
>>>
>>>Can anyone tell me how and if possible to have a file
>>>that I can let people read and write to but not delete from?
>>>
>>>eg. file called hello has one line of text in it saying:
>>>"Hello I am a file"
>>>
>>>I want everyone to be able to read this file or add extra lines but not
>>>delete
>>>what is already there???
>>>
>>>Craig
>>>
>>>
>>>  
>>>      
>>>
>>-- 
>>
>>    
>>



More information about the plug mailing list