I would like to disable the mailcheck in FreeBSD 9.1. My login shell is BASH, so I have tried to add
unset MAILCHECK
in /root/.bashrc
and /root/.profile
, but I still get those messages.
Question
Is there a way to get rid of those messages?
I would like to disable the mailcheck in FreeBSD 9.1. My login shell is BASH, so I have tried to add
unset MAILCHECK
in /root/.bashrc
and /root/.profile
, but I still get those messages.
Question
Is there a way to get rid of those messages?
Those messages are probably periodic reports. It's quite common to set
daily_show_success=NO
in/etc/periodic.conf
so it doesn't generate "all's good" messages. Also,daily_output="$destination"
should be set to your e-mail address or a log file that you can monitor. The same can be set forweekly_
andmonthly_
- and probably should be.You can delete those e-mails by starting
mail
,d *
to delete all messages, andq
to quit.Disabling the mail check is usually a mistake. If a daemon is configured incorrectly to deliver mail to the local root, you want to know, it might have something important to say and you'll miss those messages if you disable the mailcheck.
In addition to Dennis' answer, FreeBSD sets the
MAIL
environment variable for all users in thedefault
login class. This is in/etc/login.conf
.You can change this in several ways:
Edit
/etc/login.conf
and removeMAIL=/var/mail/$
from thesetenv
line. You then need to compile the login database by runningcap_mkdb /etc/login.conf
.Create a new login class that just applies to you, or a group of users. Set this for each user by using
pw usermod <username> -L <class>
.Create a user-specific
~/.login.conf
. This file should have a record calledme
. This can override a subset of the global settings. Likewise this file needs to be compiled withcap_mkdb
.See
login.conf(5)
for more information on the login capabilities database.That should take care of that message for root logins. If you're logging in as another user, you'll need to add that to the
~/.bashrc
of each user you want to disable it for. Or you can put it in the central startup file:/etc/profile
to have it take effect for all users.You will need to check to see if
MAILCHECK
is being set at a later point in the startup file sequence overriding yourunset
.Note that the startup files are processed as follows (from the Bash Manual) (emphasis mine):
edit the file
/etc/crontab
and change the lineMAILTO=root
toMAILTO=""
Source: http://michaelprogramming.blogspot.com/2014/01/disable-you-have-new-mail-in.html