suppressing motd on FreeBSD 13.0+

On one recent FreeBSD 13 host, I noticed a lack of motd. The MOTD (Message Of The Day) appears when you login.

Typically, it looks like this:

[dan@rose:~] $ r720
Last login: Mon Aug  2 00:30:13 2021 from air01.startpoint.vpn.unixathome.org
FreeBSD 13.0-RELEASE-p3 (GENERIC) #0: Tue Jun 29 19:46:20 UTC 2021

Welcome to FreeBSD!

Release Notes, Errata: https://www.FreeBSD.org/releases/
Security Advisories:   https://www.FreeBSD.org/security/
FreeBSD Handbook:      https://www.FreeBSD.org/handbook/
FreeBSD FAQ:           https://www.FreeBSD.org/faq/
Questions List: https://lists.FreeBSD.org/mailman/listinfo/freebsd-questions/
FreeBSD Forums:        https://forums.FreeBSD.org/

Documents installed with the system are in the /usr/local/share/doc/freebsd/
directory, or can be installed later with:  pkg install en-freebsd-doc
For other languages, replace "en" with a language code like de or fr.

Show the version of FreeBSD installed:  freebsd-version ; uname -a
Please include that output and any error messages when posting questions.
Introduction to manual pages:  man man
FreeBSD directory layout:      man hier

To change this login announcement, see motd(5).
You can search for documentation on a keyword by typing

	apropos keyword
$ 

However, on one host, I noticed:

[dan@rose:~] $ r720-02
Last login: Tue Aug  3 16:42:47 2021 from 108.52.237.133
$ 

I liked that. Short, concise, and I’m much more likely to notice that login date.

The man page (motd) didn’t tell me how to disable it, apart from creating $HOME/.hushlogin, which I didn’t want to do for every login.

My clue was:

/var/run/motd can be updated without a system reboot by manually
     restarting the motd service after updating /etc/motd.template:
           service motd restart

Let’s try that on the host without motd:

[dan@r720-02:~] $ sudo service motd restart
Cannot 'restart' motd. Set update_motd to YES in /etc/rc.conf or use 'onerestart' instead of 'restart'.
[dan@r720-02:~] $ 

Ahah!

Let’s try this:

[dan@r720-01:~] sudo sysrc update_motd="NO"
update_motd: YES -> NO

No, logging in, I still got the motd.

Solution:

[dan@r720-01:~] $ sudo rm /var/run/motd
[dan@r720-01:~] $ 

Now when I login, I get just this:

[dan@rose:~] $ r720
Last login: Tue Aug  3 16:46:49 2021 from rose.startpoint.vpn.unixathome.org
If you don't want to edit /etc/rc.conf directly, use sysrc(8) to add and remove entries.
Use "sysrc name=value" to add an entry and "sysrc -x name" to delete an entry.

		-- Lars Engels 
$ 

The text after ‘Last login’ is from fortune.

I’m OK with the fortune message.

Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

Leave a Comment

Scroll to Top