Pierre Carrier's blog

All my subtitle ideas sounded cheesy.

Tweak the MOTD under Ubuntu Precise

  • The MOTD is generated by scripts in /etc/update-motd.d. You can change those to affect the generated MOTD.

  • To stop displaying the MOTD on every login (“Welcome to Ubuntu[…]”), edit /etc/pam.d/login like so:

1
2
3
4
5
--- /etc/pam.d/login.before
+++ /etc/pam.d/login
@@ -85 +85 @@
-session optional pam_motd.so
+# session optional pam_motd.so

A similar change is required for all PAM services showing the MOTD, often including sshd.

  • To disable this mechanism, instead of commenting the line, add the noupdate option like so:
1
2
3
4
5
--- /etc/pam.d/login.before
+++ /etc/pam.d/login
@@ -85 +85 @@
-session optional pam_motd.so
+session optional pam_motd.so noupdate

Again, the same change is required in all services using pam_motd.so. You also need to disable the execution on boot with this change:

1
2
3
4
5
--- /etc/init/mounted-run.conf.before
+++ /etc/init/mounted-run.conf
@@ -22 +22 @@
- [ -d "/etc/update-motd.d" ] && run-parts --lsbsysinit /etc/update-motd.d > /run/motd &
+ # [ -d "/etc/update-motd.d" ] && run-parts --lsbsysinit /etc/update-motd.d > /run/motd &