5

When I log in to a TTY I get the following nice text:

Ubuntu 16.04.03 LTS
Log-in: username
Password:
Last log-in date/time
Welcome to Ubuntu 16.04.03 LTS

 * Documentation:
 * Management:
 * Support:

9 packages to update
4 updates are security updates

I would like the last 2 lines repeated every time I open a GUI terminal for all users in the adm group (but will settle for having the entire thing displayed each and every time I open a GUI Terminal for all users)

I tried the obvious:

fab-root@fab-ux-predator:~
$ cd /etc/update-motd.d/
fab-root@fab-ux-predator:/etc/update-motd.d
$ ./90-updates-available 
fab-root@fab-ux-predator:/etc/update-motd.d
$ cat /var/lib/update-notifier/updates-available
cat: /var/lib/update-notifier/updates-available: Permission denied
fab-root@fab-ux-predator:/etc/update-motd.d
$

What am I missing?

P.S. Obviously I can chmod o+r the file, but how future-proof would that be?

Fabby
  • 34,259

2 Answers2

4

It is a bit slow but it will generate the package/update information. Append this to the users .bashrc file:

/usr/lib/update-notifier/apt-check --human-readable
muru
  • 197,895
  • 55
  • 485
  • 740
stumblebee
  • 3,547
2

The entire output is in /run/motd.dynamic:

$ grep motd /etc/pam.d -R
/etc/pam.d/sshd:# This includes a dynamically generated part from /run/motd.dynamic
/etc/pam.d/sshd:# and a static (admin-editable) part from /etc/motd.
/etc/pam.d/sshd:session    optional     pam_motd.so  motd=/run/motd.dynamic
/etc/pam.d/sshd:session    optional     pam_motd.so noupdate
/etc/pam.d/login:# This includes a dynamically generated part from /run/motd.dynamic
/etc/pam.d/login:# and a static (admin-editable) part from /etc/motd.
/etc/pam.d/login:session    optional   pam_motd.so motd=/run/motd.dynamic
/etc/pam.d/login:session    optional   pam_motd.so noupdate

So, in your .bashrc, you could append:

[[ -r /run/motd.dynamic ]] && cat /run/motd.dynamic

Or:

[[ -r /run/motd.dynamic ]] && grep update /run/motd.dynamic
muru
  • 197,895
  • 55
  • 485
  • 740