[NTLUG:Discuss] protecting /dev/null from miswritten redirects.

Richard Geoffrion ntlug at rain4us.net
Thu Jan 8 12:49:06 CST 2004


Chris Cox wrote:
> Richard Geoffrion wrote:
>> How does one protect  /dev/null from being accidently overwritten by
>> command output?  Yes it's a self inflicted would but I'm tired of
>> the infliction.
>>
>
> Tricky... what command is being used to overwrite it??
> Are you sure the command isn't removing it and then
> replacing it??
>
>

[snipet from the vpopmail installation instructions]
5. Setup crontab for --enable-roaming-users=y (default is disabled)
        Add a line to roots crontab
        $ su
        # crontab -e

        add a line like the following:

        40 * * * * /home-dir-of-vpopmail/bin/clearopensmtp 2>&1 > /dev/null

        replace "home-dir-of-vpopmail" with the home directory of vpopmail
user.
        To find the home dir of vpopmail:
                grep vpopmail /etc/passwd
        pick out the entry for the home dir
[/snipet]

whereby I issue the following command instead:

echo '40 * * * * /home/vpopmail/bin/clearopensmtp \
2>&1> /dev/null' > /var/spool/cron/crontabs/vpopmail

now, I THINK I have all the quoting done correctly there...but I'm
constantly  getting the OUTPUT of my commands stored in a file called
/dev/null.

I'm on the lookout for the very next time this happens so I can track it
down. (now that I know what I'm looking for.)

--
Richard




More information about the Discuss mailing list