1

So here's the deal. I've created /etc/motd.tail as suggested by Ubuntu documentation which should append STATIC content to /etc/motd . However as well as this work, it displays the MOTD TWICE when I log on to the server via ssh. W00t ?! Is there any way to fix this ? This does seem like a bug to me. Thanks

0

Bug, no...

It sounds like you have something wrong in your ~/.bashrc file. Look and see if there are any lines which add motd.tail. Maybe look for motd*?

If that doesn't work, just append directly to MOTD. Command:

sudo -i
cat /etc/motd.tail >> /etc/motd

Then, you can (if you want), rm /etc/motd.tail.
Get out of root by exiting.

Just remember to directly edit the motd file as a workaround.

  • 1
    Its a fresh install. So, if there is something weird with the bashrc files it certainly hasn't been updated by us :( Updating motd directly defies the point of motd.tail - isn't that going to be overridden. My understanding is that motd is DYNAMICALLY created whilst motd.file should contain just static content. – gyre Jan 15 '14 at 11:17
0

For me it was two places causing motd to be displayed twice: 1) pam.d 2) sshd

~> cd /etc/pam.d ~> grep -i motd * and then editing /etc/pam.d/sshd (may differ from version to version so confirm with grep output) and hash out these two lines:

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

My /etc/ssh/sshd_config also had #PrintMotd=yes (default is yes so it was active even if it was #'d out)

In the end I set /etc/ssh/sshd_config MOTD option to PrintMotd=no (not removed the # and set to no to replace the default) and enabled the /etc/pam.d/sshd motd lines so the /etc/ssh/sshd_config option printlastlog=yes will print the last login information after the pam.d motd is displayed.

Pam will also use the options in /etc/update-motd.d/ to customise the /etc/motd as well which sshd will not do as it will simply display what is already there.

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.