[Novalug] where are they?

Mark Smith mark@winksmith.com
Tue Mar 10 16:50:33 EDT 2015


oh, and as an example:

1. create a 1GB file and note the size of your file system.

	dd if=/dev/zero of=/tmp/zero bs=1M count=1000
	df -h /tmp/

2. for the file descriptor to remain open:

	sleep 1h < /tmp/zero &

3. delete the reference to the file within the directory:

	rm /tmp/zero

4. note the file system size has NOT gone done by a GB.

	df -h /tmp/

5. kill your 'sleep' thus releasing the open file descriptor.  then note
   the file system size NOW has gone done by the appropriate amount:

	kill %%
	df -h /tmp/

On Wed, Mar 11, 2015 at 09:22:43AM +1300, Mark Smith via Novalug wrote:
> On Tue, Mar 10, 2015 at 10:05:01AM -0400, John Franklin via Novalug wrote:
> > A common thing for applications to do is create and open a temp file, then "unlink" it from the filesystem.  This both prevents other snooping processes from getting a handle to it and ensures the temp file is freed when the process dies, even if it is from an uncaught SIGKILL.
> 
> a useful side-effect of this is that no one else can open and peek into
> your temp file too.  you can put whatever you want into it fairly safely.
> there is no filename, so what would you open?

-- 
Hei konā mai
Mark Smith
mark@winksmith.com



More information about the Novalug mailing list