[3857] in bugtraq
Re: mktemp() and friends
daemon@ATHENA.MIT.EDU (Benedikt Stockebrand)
Tue Dec 24 14:42:52 1996
Date: Tue, 24 Dec 1996 02:34:45 +0100
Reply-To: Benedikt Stockebrand <benedikt@devnull.ruhr.de>
From: Benedikt Stockebrand <benedikt@devnull.ruhr.de>
X-To: avalon@coombs.anu.edu.au
To: Multiple recipients of list BUGTRAQ <BUGTRAQ@netspace.org>
In-Reply-To: Darren Reed's message of Tue, 24 Dec 1996 07:51:31 +1100
Darren Reed <avalon@coombs.anu.edu.au> writes:
> Then there are temporary files used in shell scripts - quite often root
> cornjobs get implemented to write to some file in /tmp
A more reasonable approach would be to use $UID and/or $$ and/or
$RANDOM and/or `date +%s` (if you've got a GNU date) in the file name.
Like /tmp/cron.daily.`date +%s`.$$ --- one of my favourites.
> (I prefer to use /, ~root or /etc).
While it is acceptable to put temporary stuff in ~, /tmp has the
advantage that it may be cleaned up after a reboot. And consider both
/ and /etc potentially both small and mounted R/O. So if you want to
stay portable, stick with /tmp. Finally, what if you're using an
NFS-mounted ~ and run the same stuff on multiple machines --- ok,
that's usually not a problem with ~root, but you can't generalize this
approach.
Ben
--
Ben(edikt)? Stockebrand Runaway ping.de Admin---Never Ever Trust Old Friends
My name and email address are not to be added to any list used for advertising
purposes. Any sender of unsolicited advertisement e-mail to this address im-
plicitly agrees to pay a DM 500 fee to the recipient for proofreading services.