2

Upon login I get a prompt and none of the stuff from /etc/update-motd.d

Version Welcome to Ubuntu 21.10 (GNU/Linux 5.13.0-30-generic x86_64)

If I run run-parts /etc/update-motd.d/ I get the expected output - it just doesn't run automatically upon login.

I don't have $HOME/.hushlogin configured at all.

Thanks!

salvo
  • 231
  • 3
  • 7
  • How are you logging in? GUI, terminal emulator, bash --login, agetty, serial terminal or what? Read man bash about Startup Files read the startup files to see which one does the run-parts /etc/update-motd.d/ and under what conditions. – waltinator Feb 24 '22 at 06:51
  • ... it's done via PAM these days I think (/etc/pam.d/login for local sessions or /etc/pam.d/sshd for remote sessions) – steeldriver Feb 24 '22 at 13:41
  • @waltinator I'm logging in via SSH to the terminal, no GUI. – salvo Feb 25 '22 at 07:30
  • @steeldriver: I see that the /etc/pam.d/sshd file contains the session optional pam_motd.so motd=/run/motd.dynamic which doesn't exist on my system. I'll chase that down - thanks for the heads up!! – salvo Feb 25 '22 at 07:31
  • Thanks @steeldriver that worked. I needed to amend the /etc/ssh/sshd_config to allow PAM to be triggered. Thanks for the hint!! – salvo Feb 25 '22 at 07:42
  • @salvo please consider turning your findings into an answer – steeldriver Feb 25 '22 at 13:06

1 Answers1

2

Solved!

The file in /etc/ssh/sshd_config needed to be set this line UsePAM yes. That allowed the interactive login to trigger the file /etc/pam.d/sshd that contained session optional pam_motd.so motd=/run/motd.dynamic to run, which in turn ran the files in /etc/update-motd.d/ to trigger my MOTD when I login.

salvo
  • 231
  • 3
  • 7
  • 1
    Following the steps of the solution, I found the file "/run/motd.dynamic" did not exist, but "/run/motd.dynamic.new" did. I copied the "new" file to the expected name and it worked for me. Thanks. – Ted H. Oct 14 '22 at 19:43
  • the rename that @TedH. mentioned was also the solution for me. may you can edit the answer with this "additional step"? it could help :) – Latra May 10 '23 at 13:37