No MOTD on Ubuntu 14.04...?

On a base install of Ubuntu 14.04.2 LTS, simply drop the message you want in:

/etc/motd

By default, the MOTD will appear at the end of the other dynamic MOTD content. For example, here's the output from a Vagrant ubuntu/trusty64 (v20150506.0.0) box with a /etc/motd file added:

$ vagrant ssh
Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 3.13.0-52-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Thu May 14 20:06:56 UTC 2015

  System load:  0.39              Processes:           78
  Usage of /:   2.8% of 39.34GB   Users logged in:     0
  Memory usage: 24%               IP address for eth0: 10.0.2.15
  Swap usage:   0%

  Graph this data and manage this system at:
    https://landscape.canonical.com/

  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud

0 packages can be updated.
0 updates are security updates.


#####################################
Howdy! This message is from /etc/motd
#####################################

Last login: Thu May 14 20:06:56 2015 from 10.0.2.2
vagrant@vagrant-ubuntu-trusty-64:~$

That's all there is to it if you're working on a system with the default settings.


Some other troubleshooting notes:

  • Using "/etc/motd" is a change from earlier versions. Recommendations for 12.02 were to use "/etc/motd.tail". That doesn't work in 14.04.2.

  • Other recommendations I've seen include changing some values in "/etc/ssh/sshd_config". In case those have been altered, here's the defaults that work:

    UsePAM yes
    PrintMotd no
    
  • Likewise, here are the defaults for the /etc/pam.d/login I've seen referenced:

    session    optional   pam_motd.so  motd=/run/motd.dynamic noupdate
    session    optional   pam_motd.so
    

That's everything I've seen referenced for troubleshooting.


Try to add:

 UsePAM yes

in your /etc/ssh/sshd_config as suggested in this bug and in Can't configure MOTD properly in Ubuntu 10.04 Server (update-motd command not found)

With UsePAM enabled, PAM will automatically update the MOTD and print it for you when you log in. You have to disable PrintMOTD or SSH will print it as well, so you'll see it twice, which is annoying.

I'm not sure about this, but in case you get motd twice, you should set PrintMOTD to no.

Tags:

Ssh

Motd