解决Centos关闭You have new mail in /var/spool/mail/root提示(转)
今天查看内存的时候 出现一天奇怪的提示
You have new mail in /var/spool/mail/root
有的时候每敲一下回车,就出来You have new mail in /var/spool/mail/root的提示,究竟是为什么呢?
Linux 系统经常会自动发出一些邮件来提醒用户系统中出了哪些问题(收件箱位置:/var/mail/)。可是这些邮件都是发送给 root 用户的。出于系统安全考虑,通常不建议大家直接使用 root 帐户进行日常操作。所以要想点办法来让系统把发给 root 用户的邮件也给自己指定的外部邮箱发一份,或者是直接关闭此项服务。
1、关闭sendmail服务,这里介绍一种不用关闭sendmail服务的方法
echo “unset MAILCHECK” >> /etc/profilesource /etc/profile
关闭sendmail的功能:
chmod 0 /usr/sbin/sendmailmv /usr/sbin/sendmail /usr/sbin/sendmail.bakln -s /var/qmail/bin/sendmail /usr/sbin/sendmail
清空 /var/spool/mail/root日志
cat /dev/null > /var/spool/mail/rootcat /dev/null>;/var/spool/mail/root
2、root邮件转发到自己的邮箱
或者转发到自己的邮箱,下面介绍下怎么转发到自己的邮箱(此方法未经本人亲自验证 来源于网络,有喜欢折腾的请自己研究,成功了 可以跟帖分享经验)
方法一:
修改此文件
/etc/log.d/logwatch.conf
添加MailTo = root,xxx@xxx.com
方法二
/etc/aliases
添加root: xxx@xxx.com
注意:好像如果设置成和主机同域的,好像邮件就发不成,比如本机邮件就是moper.me,那么发这个就没法发,相应的发其他邮箱就可以成功。
关于“/etc/aliases”:
当sendmail收到一个要送给xxx的信时,它会依据/etc/aliases文件中的内容送给另一个使用者。这个功能可以创造一个只有在信件 系统内才有效的使用者。例如mailing list就会用到这个功能,在 mailing list 中,我们可能会创造一个叫 redlinux@link.ece.uci.edu的 mailinglist,但实际上并没有一个叫redlinux的使用者。实际 aliases档的内容是将送给这个使用者的信都收给mailing list处理程式负责分送的工作。
/etc/aliases是一个文本文档,而sendmail需要一个二进位格式的 /etc/aliases.db。newaliases的功能传是将/etc/aliases转换成一个sendmail所能了解的db文件:
[root@centos ~]# newaliases
//somebody除root外的其它用的邮件可以通过在用户/home/下建立一个.forward文件实现转发:
other1
other2
文件权限设为600,作用一样,但.forward可以由用户自行维护,而aliases则只有治理员才能修改。
设定~/.forward档案加入转寄目的即可
网上很多教程是你抄我,我抄你,根本就没有验证过的,比如有种方法是修改”/usr/share/logwatch/default.conf/logwatch.conf“配置文件,在centos6中根本就没有这个文件,至于以前的版本有没有就不知道了。
还有很多教程,只有“echo "unset MAILCHECK" >> /etc/profile”,而没有“source /etc/profile”,这也是不对的。
解决Centos关闭You have new mail in /var/spool/mail/root提示(转)的更多相关文章
- 解决Centos关闭You have new mail in /var/spool/mail/root提示
昨天搬到阿里云了. 装的系统是Centos 6.3的加固版 今天查看内存的时候 出现一天奇怪的提示 You have new mail in /var/spool/mail/root 有的时候每敲一下 ...
- You have new mail in /var/spool/mail/root 解决烦琐提示的方法
今天写定时任务时,出现奇怪的提示,有的时候每敲一下回车,也出现奇怪的提示 You have new mail in /var/spool/mail/root 阿西吧........表示很烦...究竟是 ...
- Linux出现You have new mail in /var/spool/mail/root提示,关闭邮件提示清理内容的解决方案
Linux出现You have new mail in /var/spool/mail/root提示,关闭邮件提示的解决方案 有的时候敲一下回车,就出来You have new mail in /va ...
- Linux关闭You have new mail in /var/spool/mail/root提示
终端远程登陆Linux后经常提示You have new mail in /var/spool/mail/root 这个提示是LINUX会定时查看LINUX各种状态做汇总,每经过一段时间会把汇总的信息 ...
- 禁止Centos系统You have new mail in /var/spool/mail/root提示
禁止Centos系统You have new mail in /var/spool/mail/root提示 https://blog.csdn.net/oyym_mv/article/details/ ...
- 解决You have new mail in /var/spool/mail/root提示
终端远程登陆后经常提示You have new mail in /var/spool/mail/root 这个提示是LINUX会定时查看LINUX各种状态做汇总,每经过一段时间会把汇总的信息发送的ro ...
- You have new mail in /var/spool/mail/root 烦不烦你(转)
转自(http://blog.csdn.net/yx_l128125/article/details/7425182) 有时在进入系统的时候经常提示You have new mail in /var/ ...
- You have new mail in /var/spool/mail/root消除提示的方法
有时在进入系统的时候经常提示You have new mail in /var/spool/mail/root 你觉得烦人---解决方法: 修改系统配置文件/etc/profile,告诉系统不要去检查 ...
- you have new mail in /var/spool/mail/root !
今天开发的同事告诉我,他在登录系统时老是提示you have new mail in /var/spool/mail/root ! 我一猜就知道他们肯定又自己写定时任务了,这样的事已经发生过好几回了, ...
随机推荐
- Appendix A. Common application properties
Appendix A. Common application properties Prev Part X. Appendices Next URl链接:https://docs.spring.i ...
- [JS] jquery控件基本要点备份
(1)CDN Google CDN:<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min. ...
- 【转】【C#】迭代器IEnumerable和IEnumerator
迭代器模式是设计模式中行为模式(behavioral pattern)的一个例子,他是一种简化对象间通讯的模式,也是一种非常容易理解和使用的模式.简单来说,迭代器模式使得你能够获取到序列中的所有元素而 ...
- 使用HashMap,put()表示放置元素,get()表示取元素
SortedSet可自动为元素排序. SortedSet的实现类是TreeSet:它的作用是字为添加到TreeSet中的元素排序. 与HashSet不同,TreeSet并不需要实现HashCode() ...
- 【BZOJ】3172: [Tjoi2013]单词(后缀自动机)
http://www.lydsy.com/JudgeOnline/problem.php?id=3172 随便搞个sam就行了.(其实一开始看到数据n<=200, 单词长度不超过1e6,然后感觉 ...
- 《网络编程》非堵塞 I/O
概述 在前面文章中,我们介绍了 I/O 的五种模型<I/O 模型>.从那里能够知道,非堵塞式的 I/O 是进程调用 I/O 操作时.若数据未准备就绪.则马上返回一个 EWOULDBLOCK ...
- mysql 分页sql
-- pageSize=3 pageIndex total=7 -- 开始行号 startRowNum=(pageIndex-1)*pageSize+1; -- 结束行号 endRowNum=page ...
- sdut 面向对象程序设计上机练习十(运算符重载)
面向对象程序设计上机练习十(运算符重载) Time Limit: 1000MS Memory limit: 65536K 题目描写叙述 定义一个复数类Complex,重载运算符"+" ...
- hdu 2553:N皇后问题(DFS遍历,水题)
N皇后问题 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submi ...
- WebGL中的OpenGL着色器语言
在webgl中,调用了OpenGL-ES-2.0的API,而在OpenGL-ES专为嵌入式设备设计,其和其它设备一样,都是使用GLSL(GL Shading Language)来编写片段程序并执行于G ...