Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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