原来linux下添加用户后,会在系统里自动加一个邮箱(系统邮箱),路径是:/var/spool/mail/用户名.
可以直接用命令#rm -rf /var/spool/mail/用户名
这样就可以再次添加同一名字的用户.
解决You have new mail in /var/spool/mail/root提示
终端远程登陆后经常提示You have new mail in /var/spool/mail/root
这个提示是LINUX会定时查看LINUX各种状态做汇总,每经过一段时间会把汇总的信息发送的root的邮箱里,以供有需之时查看。
一般这种情况mail的内容就只是一些正常的系统信息或者是比较重要的错误报告。
如果你安装了mutt的话直接用这个命令就可以查看mail的内容(用root登陆先),没有装的话用cat /var/spool/mail/root查看(用root登陆先)。
查看内容:
[root@tan ~]# cat /var/spool/mail/root
From root@tan.localdomain Wed May ::
Return-Path: <root@tan.localdomain>
X-Original-To: root
Delivered-To: root@tan.localdomain
Received: by tan.localdomain (Postfix, from userid )
id AD13C101A70C; Wed, May :: + (CST)
To: root@tan.localdomain
From: tan@tan.localdomain
Auto-Submitted: auto-generated
Subject: *** SECURITY information for tan ***
Message-Id: <.AD13C101A70C@tan.localdomain>
Date: Wed, May :: + (CST) tan : May :: : tan : user NOT in sudoers ; TTY=pts/ ; PWD=/home/tan ; USER=root ; COMMAND=/sbin/useradd tan2 From root@tan.localdomain Wed May ::
Return-Path: <root@tan.localdomain>
X-Original-To: root
Delivered-To: root@tan.localdomain
Received: by tan.localdomain (Postfix, from userid )
id F0D65101A70C; Wed, May :: + (CST)
To: root@tan.localdomain
From: tan@tan.localdomain
Auto-Submitted: auto-generated
Subject: *** SECURITY information for tan ***
Message-Id: <.F0D65101A70C@tan.localdomain>
Date: Wed, May :: + (CST) tan : May :: : tan : user NOT in sudoers ; TTY=pts/ ; PWD=/home/tan ; USER=root ; COMMAND=/sbin/useradd tan2 From root@tan.localdomain Wed May ::
Return-Path: <root@tan.localdomain>
X-Original-To: root
Delivered-To: root@tan.localdomain
Received: by tan.localdomain (Postfix, from userid )
id C3BD8101A70C; Wed, May :: + (CST)
To: root@tan.localdomain
From: tan@tan.localdomain
Auto-Submitted: auto-generated
Subject: *** SECURITY information for tan ***
Message-Id: <.C3BD8101A70C@tan.localdomain>
Date: Wed, May :: + (CST) tan : May :: : tan : user NOT in sudoers ; TTY=pts/ ; PWD=/home/tan ; USER=root ; COMMAND=/sbin/useradd tan2 From root@tan.localdomain Wed May ::
Return-Path: <root@tan.localdomain>
X-Original-To: root
Delivered-To: root@tan.localdomain
Received: by tan.localdomain (Postfix, from userid )
id 68249101A71A; Wed, May :: + (CST)
To: root@tan.localdomain
From: tan@tan.localdomain
Auto-Submitted: auto-generated
Subject: *** SECURITY information for tan ***
Message-Id: <.68249101A71A@tan.localdomain>
Date: Wed, May :: + (CST) tan : May :: : tan : user NOT in sudoers ; TTY=pts/ ; PWD=/etc ; USER=root ; COMMAND=/bin/cat sudoers
也可以设置把这个信息发送到管理员邮箱
日志分析工具 Logwatch能够对Linux 的日志文件进行分析,并自动发送mail给相关处理人员,可定制需求 Logwatch的mail功能是借助宿主系统自带的mail server发邮件的,系统需安装mail server , 如sendmail,postfix,Qmail等,具体配置不叙述
关闭提示:
[root@check1 ~]# echo "unset MAILCHECK">> /etc/profile
[root@check1 ~]# source /etc/profile
查看:
[root@check1 ~]# ls -lth /var/spool/mail/
total 49M
-rw------- root mail 49M Jul : root
-rw-rw---- nginx mail May : nginx
-rw-rw---- zabbix mail May : zabbix
清空:
[root@check1 ~]# cat /dev/null > /var/spool/mail/root
关闭提示:
1
2
|
[root@check1 ~] # echo "unset MAILCHECK">> /etc/profile
[root@check1 ~] # source /etc/profile
|