加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

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

发布时间:2020-12-14 01:26:21 所属栏目:Linux 来源:网络整理
导读:原来linux下添加用户后,会在系统里自动加一个邮箱(系统邮箱),路径是:/var/spool/mail/用户名. ????? 可以直接用命令#rm -rf /var/spool/mail/用户名 ????? 这样就可以再次添加同一名字的用户. ? 解决You have new mail in /var/spool/mail/root提示 终端远程

原来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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读