解决linux下创建用户时出现 Creating mailbox file: 文件已存在

Posted tan-y-q

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决linux下创建用户时出现 Creating mailbox file: 文件已存在相关的知识,希望对你有一定的参考价值。

原来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登陆先)。

查看内容:

[[email protected] ~]# cat /var/spool/mail/root
From [email protected]  Wed May  1 14:59:35 2019
Return-Path: <[email protected]>
X-Original-To: root
Delivered-To: [email protected]
Received: by tan.localdomain (Postfix, from userid 0)
    id AD13C101A70C; Wed,  1 May 2019 14:59:34 +0800 (CST)
To: [email protected]
From: [email protected]
Auto-Submitted: auto-generated
Subject: *** SECURITY information for tan ***
Message-Id: <20190501065934[email protected]>
Date: Wed,  1 May 2019 14:59:34 +0800 (CST)

tan : May  1 14:59:34 : tan : user NOT in sudoers ; TTY=pts/1 ; PWD=/home/tan ; USER=root ; COMMAND=/sbin/useradd tan2


From [email protected]  Wed May  1 15:04:53 2019
Return-Path: <[email protected]>
X-Original-To: root
Delivered-To: [email protected]
Received: by tan.localdomain (Postfix, from userid 0)
    id F0D65101A70C; Wed,  1 May 2019 15:04:52 +0800 (CST)
To: [email protected]
From: [email protected]
Auto-Submitted: auto-generated
Subject: *** SECURITY information for tan ***
Message-Id: <20190501070452[email protected]>
Date: Wed,  1 May 2019 15:04:52 +0800 (CST)

tan : May  1 15:04:52 : tan : user NOT in sudoers ; TTY=pts/1 ; PWD=/home/tan ; USER=root ; COMMAND=/sbin/useradd tan2


From [email protected]  Wed May  1 15:06:08 2019
Return-Path: <[email protected]>
X-Original-To: root
Delivered-To: [email protected]
Received: by tan.localdomain (Postfix, from userid 0)
    id C3BD8101A70C; Wed,  1 May 2019 15:06:08 +0800 (CST)
To: [email protected]
From: [email protected]
Auto-Submitted: auto-generated
Subject: *** SECURITY information for tan ***
Message-Id: <20190501070608[email protected]>
Date: Wed,  1 May 2019 15:06:08 +0800 (CST)

tan : May  1 15:06:08 : tan : user NOT in sudoers ; TTY=pts/1 ; PWD=/home/tan ; USER=root ; COMMAND=/sbin/useradd tan2


From [email protected]  Wed May  1 15:18:14 2019
Return-Path: <[email protected]>
X-Original-To: root
Delivered-To: [email protected]
Received: by tan.localdomain (Postfix, from userid 0)
    id 68249101A71A; Wed,  1 May 2019 15:18:14 +0800 (CST)
To: [email protected]
From: [email protected]
Auto-Submitted: auto-generated
Subject: *** SECURITY information for tan ***
Message-Id: <20190501071814[email protected]>
Date: Wed,  1 May 2019 15:18:14 +0800 (CST)

tan : May  1 15:18:14 : tan : user NOT in sudoers ; TTY=pts/1 ; PWD=/etc ; USER=root ; COMMAND=/bin/cat sudoers

也可以设置把这个信息发送到管理员邮箱

日志分析工具 Logwatch能够对Linux 的日志文件进行分析,并自动发送mail给相关处理人员,可定制需求 Logwatch的mail功能是借助宿主系统自带的mail server发邮件的,系统需安装mail server , 如sendmail,postfix,Qmail等,具体配置不叙述

关闭提示:

[[email protected] ~]# echo "unset MAILCHECK">> /etc/profile
[[email protected] ~]# source /etc/profile

查看:

[[email protected] ~]# ls -lth /var/spool/mail/
total 49M
-rw------- 1 root mail 49M Jul 4 13:43 root
-rw-rw---- 1 nginx mail 0 May 21 11:46 nginx
-rw-rw---- 1 zabbix mail 0 May 16 15:48 zabbix

清空:

[[email protected] ~]# cat /dev/null > /var/spool/mail/root

 

关闭提示:

1
2
[[email protected] ~]# echo "unset MAILCHECK">> /etc/profile
[[email protected] ~]# source /etc/profile

以上是关于解决linux下创建用户时出现 Creating mailbox file: 文件已存在的主要内容,如果未能解决你的问题,请参考以下文章

Linux新用户登录时出现“-bash-4.2$”的解决方法

使用 PHAssets 时出现此错误:Creating an image format with an unknown type is an error

Kali Linux中,make编译时出现错误怎么解决?

无法在当前状态下启动设备:正在创建

linux下yum安装时出现Loaded plugins: fastestmirror解决办法

创建新的 Apache Apex 项目时出现 Maven 原型错误