Resolve CentOS Close you have new mail In/var/spool/mail/root tips

Source: Internet
Author: User
Tags aliases file permissions


Yesterday moved to Ali Cloud.

The system is CentOS 6.3 's reinforced version.

Today, when I look at memory, I get a day of weird hints.

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

Sometimes every time you hit the carriage return, come out you have new mail in/var/spool/mail/root hint, exactly is why?

Linux systems often send messages automatically to remind users what's wrong with the system (Inbox location:/var/mail/). However, these messages are sent to the root user. For system security reasons, it is often not recommended that you use the root account directly for day-to-day operations. So there's a way to get the system to send a copy of the email to the root user to a designated external mailbox, or close the service directly.

1, shut down the SendMail service, here introduces one kind does not have to close the SendMail service the method

The code is as follows Copy Code


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


To turn off SendMail features:

The code is as follows Copy Code


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


Empty/var/spool/mail/root Log


The code is as follows Copy Code
Cat/dev/null >/var/spool/mail/rootcat/dev/null>;/var/spool/mail/root


Or forward to their own mailbox, below the introduction of 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 a thread to share experience)

2, the root mail forward to their own mailbox
Method One:
Modify this file

The code is as follows Copy Code
/etc/log.d/logwatch.conf
Add mailto = root,xxx@xxx.com

Method Two

The code is as follows Copy Code
/etc/aliases

Add root:xxx@xxx.com

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

About "/etc/aliases":

When SendMail receives a letter to send to XXX, it is sent to another user based on 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 the mailing list, we may create a mailinglist called redlinux@link.ece.uci.edu, but in fact, there is no user named Redlinux. The actual aliases file is the content of the letter sent to this user to the mailing list handler responsible for the delivery of the work.

/etc/aliases is a text document, and sendmail needs a binary format of the/etc/aliases.db. Newaliases's function is to convert/etc/aliases into a DB file that the SendMail can understand:

The code is as follows Copy Code

[Root@centos ~]# newaliases

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

The code is as follows Copy Code
Somebody
Other1
Other2

File permissions are set to 600, but. Forward can be maintained by the user, while aliases only the administrator can modify.

Set the ~/.forward file to join the forwarding purpose can be

Many tutorials on the Internet are you copy me, I copy you, there is no verification, such as a method is to modify the "/usr/share/logwatch/default.conf/logwatch.conf" configuration file, in the CENTOS6 there is no such file, As for the previous version there is no know.

There are many tutorials, only "echo" unset mailcheck ">>/etc/profile", and there is no "source/etc/profile", which is also wrong.

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.