Enable Dynamic MotD on Debian 11

For modifications in and around KeyHelp.
Post Reply
User avatar
Jolinar
Community Moderator
Posts: 3608
Joined: Sat 30. Jan 2016, 07:11
Location: Weimar (Thüringen)
Contact:

Enable Dynamic MotD on Debian 11

Post by Jolinar »

Warning:

The script modifies the configuration of the SSH Daemon.
Only use the script if you know what you are doing...I assume no responsibility for any damage to your setups!


Purpose of the Script:

This script has been developed to enable a dynamic Message of the Day (MotD) on a Debian-based system. The MotD is a message displayed to users upon login, and this script makes it dynamic by configuring PAM (Pluggable Authentication Module) and SSH to display dynamic content.

Tasks of the Script:
  • Sets up a log file to record script execution and potential errors.
  • Checks if the script is being executed on a specific Debian version (Debian 11/bullseye).
  • Verifies the presence of required dependencies (lsb_release, sed, cp, service).
  • Ensures that the script is executed with root privileges.
  • Modifies PAM configuration files for dynamic MotD (/etc/pam.d/sshd and /etc/pam.d/login).
  • Modifies the SSH server configuration file to disable the display of a static MotD (/etc/ssh/sshd_config).
  • Restarts the SSH server to apply the changes.
Usage:
Execute this script with root privileges on a Debian 11 (bullseye) system to enable dynamic MotD. It simplifies the process of enhancing the login experience for system administrators and users on Debian-based systems.

Here you can get the script:

Code: Select all

wget -q https://ngc4594.eu/enable_dynamic_motd.sh -O enable_dynamic_motd.sh
Wenn jemand inkompetent ist, dann kann er nicht wissen, daß er inkompetent ist. (David Dunning)

Data Collector für Community Support
___
Ich verwende zwei verschiedene Schriftfarben in meinen Beiträgen /
I use two different font colors in my posts:
  • In dieser Farbe schreibe ich als Moderator und gebe moderative Hinweise oder begründe moderative Eingriffe /
    In this color, I write as a moderator and provide moderative guidance or justify moderative interventions
  • In dieser Farbe schreibe ich als Community Mitglied und teile meine private Meinung und persönlichen Ansichten mit /
    In this color, I write as a community member and share my personal opinions and views
Post Reply