I would like to disable the mailcheck in FreeBSD 9.1. My login shell is BASH, so I have tried to add
/root/.profile, but I still get those messages.
Is there a way to get rid of those messages?
In addition to Dennis' answer, FreeBSD sets the
default login class. This is in
You can change this in several ways:
/etc/login.conf and remove
MAIL=/var/mail/$ from the
setenv line. You then need to compile the login database by running
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 called
me. This can override a subset of the global settings. Likewise this file needs to be compiled with
login.conf(5) for more information on the login capabilities database.
Those messages are probably periodic reports. It's quite common to set
/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 for
monthly_ - and probably should be.
You can delete those e-mails by starting
d * to delete all messages, and
q 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.
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 your
Note that the startup files are processed as follows (from the Bash Manual) (emphasis mine):
Invoked as an interactive login shell, or with --login
When Bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior.
When a login shell exits, Bash reads and executes commands from the file ~/.bash_logout, if it exists. Invoked as an interactive non-login shell
When an interactive shell that is not a login shell is started, Bash reads and executes commands from ~/.bashrc, if that file exists. This may be inhibited by using the --norc option. The --rcfile file option will force Bash to read and execute commands from file instead of ~/.bashrc.
So, typically, your ~/.bash_profile contains the line
if [ -f ~/.bashrc ]; then . ~/.bashrc; fi
after (or before) any login-specific initializations.
edit the file
/etc/crontab and change the line