Ubuntu – Looking to specifically customize Ubuntu SSH banner

ssh

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.

Best Answer

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.

Related Question