Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
16
rated 0 times [  16] [ 0]  / answers: 1 / hits: 26940  / 1 Year ago, mon, december 12, 2022, 1:14:19

I recently did a fresh install of Ubuntu 14.04. When I SSH, there is no MOTD (and yes, I have the appropriate command set in sshd_config).



I read a bunch of tutorials about setting up MOTD, but I realized that while I have /etc/update-motd.d, there is not /etc/motd file nor a /var/run/motd file.



How can I set these up so that I can get a MOTD via SSH?


More From » ssh

 Answers
4

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.


[#22772] Tuesday, December 13, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
istictroubli

Total Points: 306
Total Questions: 96
Total Answers: 114

Location: Sao Tome and Principe
Member since Wed, Jul 13, 2022
2 Years ago
;