On Thu, Oct 19, 2006 at 08:47:45AM +1000, James Gray wrote:
 .... 
> # Make any generated files only readable by moi
> umask 077
> MAILROOT=~/Mail
> TMP=/tmp/mail-addresses.tmp
...
>     egrep .....  >>  $TMP

This is sorta off topic, but setting umask is not enough.
Someone else could have a file of the same name as $TMP
open already, so the restrictive permissions are ineffective.

What I tend to do is make a directory and put files in
there.  You're guaranteed that mkdir will return error
if it exists already.

You can also set the perms as an option to mkdir.

So you have something like this near the top of your
script:

        if ! mkdir -m u=rwx,go= $TMP
        then
                echo >&2 "$0 : Can't create tmpdir $TMP, aborting"
                exit 1
        fi

        egrep .....  >>  $TMP/mail-addresses



Regards,

Matt
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to