当我登录控制台(例如 tty1)时,我通常会看到一条消息No mail
,我知道有一些程序在登录时检查电子邮件,但我不使用它,如何禁用该命令?
我尝试从/etc/profile.*
and进行 grep ~/.bash*
,但没有找到任何结果
答案1
该消息也可以由模块提供pam_mail
,因此您可以直接grep pam_mail *
进入/etc/pam.d
并在那里禁用它。
答案2
普京。unset MAILCHECK
.bashrc
更新
看来,上述方法不会始终如一地工作(尽管它不会造成伤害,并且在某种程度上它似乎有效)。但是,请查看这一部分/etc/pam.d/login
- 尝试注释掉最后一行(或者,如果它仍然不起作用,请进一步跟踪他们提到的遗留文件)。
# Prints the status of the user's mailbox upon successful login
# (replaces the MAIL_CHECK_ENAB option from login.defs).
#
# This also defines the MAIL environment variable. However, userdel
# also needs MAIL_DIR and MAIL_FILE variables in /etc/login.defs to
# make sure that removing a user also removes the user's mail spool
# file. See the comments in /etc/login.defs.
session optional pam_mail.so standard