gabriel rosenkoetter on Fri, 1 Nov 2002 16:30:05 -0500


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Routine maintenance


Bill Jonas wrote [tsk, mct, attribute!]
> > You might run a daily cron job consisting of something like the
> > following:
> > 
> >   find /tmp /var/tmp -atime 7 -type f -print0 |xargs -0 rm

On Fri, Nov 01, 2002 at 03:51:20PM -0500, Michael C. Toren wrote:
> You'll probably want to use "+6", rather than "7", to find any files
> which haven't been accessed in seven or more days, rather than exactly
> seven days ago.

If this is a multi-user system, you don't want to do this any time
except when it's in single-user (like, say, during boot) because
it creates a huge race condition.

(If I know that you run this once a day at a specific time because I
sit and watch top or whatever, then I can find a way to trick you
into deleting the wrong thing. Like /etc/passwd. Or a random
.htaccess file. So forth.)

The danger's a bit less if you don't do it as root, but only root
will be able to rm everything in [/var]/tmp with default permissions
(because of the sticky bit).

-- 
gabriel rosenkoetter
gr@eclipsed.net

Attachment: pgpMrahBA68CK.pgp
Description: PGP signature