Protecting files while written ...

Protecting files while written ...

Post by shar » Thu, 10 Jul 2003 06:12:21



Hi,
Let's say I have a process that creates file and write data into it.
The process will create the file with perm 755
( in result of a default umask 022 ).
At this point all users in the domain will be able to read, copy or
execute the file.
I want to protect the file until the end of the writing process.
Is there a reasonable way to do this ?
( aix 4.33 Ml 8 although it's a traditional Unix Q ).
Thanks

--
Posted via http://dbforums.com

 
 
 

Protecting files while written ...

Post by Tim Hammerquis » Thu, 10 Jul 2003 06:49:00


shark graced us by uttering:

Quote:> Let's say I have a process that creates file and write data into it.
> The process will create the file with perm 755
> ( in result of a default umask 022 ).
> At this point all users in the domain will be able to read, copy or
> execute the file.
> I want to protect the file until the end of the writing process.
> Is there a reasonable way to do this ?

Try changing the umask until after file is created, or change the
file's permissions after creation but before writing to it.

After you're done writing the file, change the perms back.

But I'm sure TMTOWTDI.

HTH,
Tim Hammerquist
--
How can you have any pudding if you don't eat your meat?
    -- Pink Floyd

 
 
 

1. Writing to write-protected floppy

Some time ago I had to take some files from home to work. I mounted a msdos
floppy (on Linux), copied the files and umounted the floppy. At the umount
the floppy started to whir, so I assumed the files ware written. At work I
found out that the floppy had been write protected, so no files had been
written.

Shouldn't there be some kind of warning? I know that Unix does write
behind, but I would have liked some kind of indication that nothing had
been written. E.g. the mount could have warned about read-only, or mounted
the floppy readonly, so that the write would have gotten an error.
--
Piet* van Oostrum, Dept of Computer Science, Utrecht University,  (*`Pete')
Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands.

PGP public key by finger or WWW http://www.cs.ruu.nl/~piet

2. linux faq?

3. rm in a script deletes write protected files

4. What does NOTRAILERS mean?

5. Protecting files while written ...

6. R5 PBG3 video accel ?

7. Can one remove write-protected files?

8. Terminal Simulator Software

9. Press Ctrl-D whiling inputting

10. Checking Tape for Write Protect

11. problem: write protected CD-RW?

12. First crash in years -- write-protected floppy?

13. Help! CD-writer write protected