This setup customizes the MOTD (Message Of The Day) displayed when logging into a server via SSH. The script provides system information in a neatly formatted way.
- Script Location: The custom MOTD script is located at
$HOME/.config/motd/custom_motd.sh
. - Backup: Backs up existing configurations to
$HOME/.local/share/motd_backups
. - SSH Config Update: Modifies
/etc/ssh/sshd_config
to disablePrintLastLog
. - Remove Default MOTD: Backs up and removes the default
/etc/update-motd.d/10-uname
script. - Create Wrapper: Creates or updates the MOTD wrapper script at
/etc/update-motd.d/99-custom-motd
to call the custom script. - PAM Configuration: Checks and verifies PAM configurations to ensure they point to the correct MOTD file.
- Restart SSH: Restarts the SSH service if any changes were made.
This process ensures that every SSH login displays the custom MOTD with updated system information.