2

Running Ubuntu Server, I have no need for PAM login, and thus disabled this service in the sshd_config file. However, oddly, there is some login info that is only displayed if you enable PAM logins (but the info is unrelated to PAM). See: https://askubuntu.com/questions/7949/where-does-the-system-information-information-come-from-on-login

I do want to show the landscape info, and I would also like to display other MOTD info (like XX pending updates) upon login. Unfortunately I lost this when disabling PAM. What is the best way to go about this? I tried PrintMotd yes in the sshd_config but that had no impact.

This is the info that was shown upon login before disabling PAM:

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 Wed May 27 02:01:41 EDT 2015

    System load: 0.0 Processes: 101 Usage of /: 6.3% of 42.1GB Users logged in: 2 Memory usage: 17%
    IP address for eth0: XXX.XXX.XXX.XXX Swap usage: 0%
    IP address for eth1: XXX.XXX.XXX.XXX

    => There are 2 zombie processes.

    Graph this data and manage this system at: https://landscape.canonical.com/

21 packages can be updated. 14 updates are security updates.

And this is all that is left after disabling PAM:

Last login: Wed May 27 01:42:36 2015 from XXX.XXX.XXX.XXX

1 Answer 1

4

That motd output is all generated by running scripts in /etc/update-motd.d/ on every login. The dynamic motd feature in Ubuntu is governed by pam_motd (see update-motd manpage for details), so you need to enable PAM login to see it.

Alternatively, you can call the scripts in the system wide shell profile. Note that you'd better not use run-parts because you have to give up some scripts which are intended to be run as root to store the output in /var/lib.

For example you can put the following in /etc/profile.d/motd.sh.

/etc/update-motd.d/00-header
/etc/update-motd.d/10-help-text
/etc/update-motd.d/50-landscape-sysinfo
# /etc/update-motd.d/90-updates-available # need root
# /etc/update-motd.d/91-release-upgrade   # need root
# /etc/update-motd.d/98-fsck-at-reboot    # need root
/etc/update-motd.d/98-reboot-required

Or you might want to periodically update /etc/motd with the output from the scripts using cron.

# NOT TESTED!
*/10 * * * * root run-parts /etc/update-motd.d >/etc/motd 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .