My /etc/motd file is showing duplicate messages. When I edit it manual, it keeps returning to the messed up version whenever a user logs in. How do I stop this? I'm using Ubuntu 10.04


The MOTD is generated by a script. To prevent the default MOTD from reverting, remove the execute bit from the /etc/update-motd.d/00-header file and put your desired MOTD text into /etc/motd.tail. Or, to keep the default MOTD text and just append your own text to it, leave the 00-header file alone and add your text to the motd.tail file.

  • Thanks - the duplicate message was in motd.tail - changing it fixed the issue – MrD Apr 28 '11 at 6:33

By default, in recent releases of Debian and Ubuntu (including yours), /etc/motd is a symbolic link to /var/run/motd, which is regenerated at each login by the update-motd framework.

If you want a static /etc/motd remove a symbolic link and create a regular file in its place. Or you can edit the pam_motd calls in /etc/pam.d/* and pass motd=/etc/motd.dougk.

The underlying issue is probably due to some breakage in /etc/update-motd.d/*, possibly a backup file duplicating the effect of the corresponding main file.

  • How this helped me fix it: I commented out one of the pam_motd lines in /etc/pam.d/ and now I'm back to a single MOTD. Thanks! – adam_0 Jan 30 '13 at 18:52

To contribute with a more updated answer:

/etc/motd is no longer a symlink as of Ubuntu 16.02. In debian it is just a regular file.

pam_motd calls all scripts in /etc/update-motd.d with run-parts to populate /var/motd.dynamic

Both /var/motd.dynamic and /etc/motd are concatenated for MOTD

Details here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.