The root mail account has been blown up by mischieveous cronjobs, and I want to completely delete the mail from the account. Is there a key for that in the mail command?

I deleted /var/mail/root but I don't know if that's the proper way to do it, or if the root file needs to be recreated manually.

Update I recreated the root file with 660 and root:mail ownership, I'll see if this is needed to let the root account get mail again.


The accepted method is:

cat /dev/null > /var/spool/mail/root

Your method should have worked, but you might need to restart sendmail (or whatever) as it might have choked on the brief lack of file.

  • I should have noted my platform: I'm on Solaris 9 atm and /var/spool/mail/ doesn't exist in this environment. That said, restarting sendmail fixed the issue. – Luke has no name Jun 30 '10 at 21:11
  • @Luke has no name: It's still /var/spool/something iirc, and you can still cat /dev/null. That basically does the same thing as deleting the file, but it preserves the file with all of it's permissions, etc. – Satanicpuppy Jul 1 '10 at 0:27
  • Or just > /var/spool/something/blah – Allen Jul 4 '10 at 21:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.