Fix CentOS off you have new mail In/var/spool/mail/root tips

Source: Internet
Author: User
Tags aliases

Today, when I look at memory, there's a strange reminder.

You have new mail in/var/spool/mail/root

Sometimes every time you knock a carriage return, you come out with the new mail in/var/spool/mail/root tips, exactly why?

Linux systems often send messages automatically to remind users of problems in their systems (Inbox location:/var/mail/). However, these messages are sent to the root user. For system security reasons, it is generally not recommended that you use the root account directly for daily operations. So to think of a way to let the system to the root of the message sent to its own designated external mailbox to send a copy, or directly shut down the service.

1, close the SendMail service, here is a way to not shut down the SendMail service


echo "unset mailcheck" >>/etc/profilesource/etc/profile

To turn off SendMail features:

chmod 0/usr/sbin/sendmailmv/usr/sbin/sendmail/usr/sbin/sendmail.bakln-s/var/qmail/bin/sendmail/usr/sbin/ SendMail

Emptying the/var/spool/mail/root log

Cat/dev/null >/var/spool/mail/rootcat/dev/null>;/var/spool/mail/root

2. Root mail forwarding to your own mailbox
Or forward to their own mailbox, the following describes how to forward to their own mailbox (this method has not personally verified from the network, have like to toss their own research, success can be thread sharing experience)

Method One:
Modify this file

/etc/log.d/logwatch.conf
Add mailto = root,[email protected]

Method Two

/etc/aliases

Add root: [email protected]

Note: It seems that if set to the same domain as the host, as if the mail will not be sent, such as the local mail is moper.me, then this will not be able to send, the corresponding post other mailboxes can be successful.

About "/etc/aliases":

When SendMail receives a letter to be sent to XXX, it will be sent to another user according to the contents of the/etc/aliases file. This feature can create a user who is only valid within the letter system. For example mailing list will use this function, in mailing list, we may create a mailinglist called redlinux@link.ece.uci.edu, but in fact there is not a user named Redlinux. The actual content of the aliases file is to be sent to the user's letter to the mailing list handler responsible for distributing the work.

/etc/aliases is a text document, and SendMail requires a binary format of/etc/aliases.db. The function of newaliases is to convert/etc/aliases into a DB file that SendMail can understand:

[Email protected] ~]# newaliases

//somebody messages other than root can be forwarded by creating a. forward file under User/home/:

Other1
Other2

The file permission is set to 600, but the. Forward can be maintained by the user, while the aliases is only available to the administrator to modify.

Set ~/.forward file to be added for forwarding purposes

Online a lot of tutorials are you copy me, I copied you, there is no verification, such as one way is to modify the "/usr/share/logwatch/default.conf/logwatch.conf" configuration file, in CENTOS6 there is no such file, As for the previous version there is no known.

There are many tutorials, only "echo" unset mailcheck ">>/etc/profile", without "Source/etc/profile", which is also wrong.

Fix CentOS off you have new mail in/var/spool/mail/root hint (GO)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.