Home / Linux/Unix/BSD / Changing the default message of the day with Debian 5 Lenny

Changing the default message of the day with Debian 5 Lenny

When you first log in to a default install of a Debian 5 Lenny machine from the command line you’ll be greeted with a message like “The programs included with the Debian GNU/Linux system are free software…”. This is controlled by the “message of the day” file. This post looks at how easy it is to change this so you can get rid of the default text.

The default MOTD message in Debian 5 Lenny is along the lines as this, where the first line will have been set to whatever your kernel and kernel date is:

Linux debian 2.6.26-1-686 #1 SMP Sat Jan 10 18:29:31 UTC 2009 i686
 
 The programs included with the Debian GNU/Linux system are free software;
 the exact distribution terms for each program are described in the
 individual files in /usr/share/doc/*/copyright.
 
 Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
 permitted by applicable law.
 

To change or remove the message, simply edit the /etc/motd file in your favourite text editor either as the root user or using sudo and then save the file. Clear all the text for no MOTD or replace it with whatever you would prefer. The next time you log in it will show the new (or no) text message.

This will work for now, but on reboot the file is reconstructed by the /etc/init.d/bootmisc.sh script. It writes out “uname -snrvm” to /var/run/motd (/etc/motd is a symbolic link to /var/run/motd) and then adds the text from /etc/motd.tail

Therefore to change what goes into the motd file on reboot, edit the /etc/motd.tail file, making it blank for no message of the day.

If you don’t want the uname information to be included in the motd file then you would also need to modify the /etc/init.d/bootmisc.sh file.