[TriLUG] Over quota script

Jon Carnes jonc at nc.rr.com
Sun Sep 15 23:12:52 EDT 2002


Hay I wrote it from memory!  The one I wrote originally used /root/tmp
but then I moved it over to using mktemp (after your good advice last
year).

Good Point about using mktemp. Thanks!

Jon
On Sun, 2002-09-15 at 22:24, John Beimler wrote:
> On Sun, 2002-09-15 at 21:51, Jon Carnes wrote:
> > Try something like this:
> >   #! /bin/bash
> >   #
> >   # Check for users that are over quota.
> >   # Assume all user dirs are under /home
> >   # look for folks above 40000kb (quota)
> >   #
> >   # Walk the users data tree to find the directory totals
> >   cd /home
> >   du -k > /root/tmp/guber
> > [...]
> 
> now Jon, I thought you had learned about mktemp. :)
> 
> mktemp will give you a temp file with a semi-random name, in /tmp. 
> Makes securing stuff easier (and you don't need to write to root's home
> directory, and you don't have a predictable temp file for people to
> attempt to exploit.
> 
> Peace.
> 
> john





More information about the TriLUG mailing list