
當我登入控制台(例如 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