4

So the default Ubuntu SSH banner has some cool stuff, mainly that it shows the packages that can be updated and whatnot. So I want to preserve those values, while customizing the rest of it.

I've already seen that I can point sshd_config to the file that would contain the text. I'm just unclear what commands will produce the update text.

For the record, what I'm talking about is this:

0 packages can be updated.
0 updates are security updates.

Help would be appreciated. Thanks so much.

5

This is not a banner, but a MOTD (Message of the Day). It is generated by PAM dynamically and the static part can be simply appended as noted in the /etc/pam.d/sshd:

# Print the message of the day upon successful login.
# This includes a dynamically generated part from /run/motd.dynamic
# and a static (admin-editable) part from /etc/motd.
session    optional     pam_motd.so  motd=/run/motd.dynamic
session    optional     pam_motd.so noupdate

The dynamic part is generated from the /etc/update-motd.d/ to /run/motd.dynamic by the pam_motd.so module.

  • 2
    Haha, i knew you would come, and answer the ssh tagged question thats why i refrained from answering :) Kudos :) Just an addition, /run/motd.dynamic is generated from files under /etc/update-motd.d/, at start run-parts is run on the files, be careful about the file names. – heemayl Oct 5 '16 at 19:55
  • 1
    @heemayl hehe, you are flattering me :D Thanks for the addition (that was the part I was unable to find in a minutes). I finally wanted to find out how does it work behind the scenes in Ubuntu (fortunatelly well documented) :) – Jakuje Oct 5 '16 at 20:01

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.