update-motd not updating /etc/motd after LTS upgrade

Helmut Schneider jumper99 at gmx.de
Fri Jun 8 11:01:58 UTC 2012


Tom H wrote:

> On Thu, Jun 7, 2012 at 6:47 PM, Helmut Schneider <jumper99 at gmx.de>
> wrote:
> > Tom H wrote:
> >> On Thu, Jun 7, 2012 at 6:05 PM, Helmut Schneider <jumper99 at gmx.de>
> >> wrote:
> >> > compdoc wrote:
> >> >
> >> >> and then find out why /var/run/motd is not being generated
> >> >
> >> > That's why I'm here. ;)
> > > 
> >> for motd to be displayed at boot?
> > 
> > Hm, only at boot?! No. Or?! Because I meanwhile found out that
> > /var/run/motd is created after a reboot but *is not* after a
> > (remote-)login (via ssh):
> > 
> > helmut at mail:~$ ls -la /var/run/motd
> > -rw-r--r-- 1 root root 1736 Jun  8 00:32 /var/run/motd
> > helmut at mail:~$ last -6R
> > helmut   pts/0        Fri Jun  8 00:41   still logged in
> > root     pts/0        Fri Jun  8 00:41 - 00:41  (00:00)
> > root     pts/0        Fri Jun  8 00:40 - 00:41  (00:00)
> > helmut   pts/0        Fri Jun  8 00:39 - 00:40  (00:01)
> > helmut   pts/0        Fri Jun  8 00:34 - 00:37  (00:03)
> > reboot   system boot  Fri Jun  8 00:32 - 00:43  (00:10)
> > 
> > wtmp begins Tue Jan  3 13:29:48 2012
> > helmut at mail:~$
> > 
> > At least on 10.04 /var/run/motd is created upon each logon.
> 
> Sorry. "/var/run/motd" is created at boot and motd's displayed at
> every login.
> 
> If you have a symlink from "/etc/motd" to "/var/run/motd" and, as
> someone else pointed out, if you have a pam_motd line for login and
> sshd, you should have your script displayed as the motd.

Put this into /etc/update-motd/:

---code
#!/bin/sh
printf "\n%s\n" "The current date:"
/bin/date
printf "\n"
---code

fresh 10.04 or 12.04: The logon time is displayed.
After upgrade from 10.04 to 12.04: The time the machine was rebooted
last is displayed.

pam_motd ist active:
helmut at mail:~$ sudo grep -ir pam_motd /etc/
/etc/pam.d/login:session    optional   pam_motd.so
/etc/pam.d/sshd:session    optional     pam_motd.so # [1]
helmut at mail:~$

Clear? :)





More information about the ubuntu-users mailing list