Disabling the MOTD on Debian 12 Systems with Updated sshd\_config Files that Still Display the MOTD
If you're looking to disable the Message of the Day (MOTD) on Debian 12 systems, but find that the MOTD still displays even after updating the /etc/ssh/sshd\_config file, this article is for you. We'll explore possible reasons for this issue and provide solutions to ensure the MOTD is properly disabled.
Understanding the MOTD
The MOTD is a message displayed to users upon login. It's typically used to provide important system information, such as server details, software updates, and security notices. The MOTD is generated by various scripts and configuration files, which can make it challenging to disable in some cases.
Possible Causes for the Issue
There are a few possible reasons why the MOTD still displays even after updating the /etc/ssh/sshd\_config file:
- Another module or configuration file is still generating the MOTD.
- The
/etc/ssh/sshd\_configfile is not being read or applied correctly. - The MOTD is being cached and needs to be cleared.
Solutions
Check for Other Modules or Configuration Files
First, check if another module or configuration file is generating the MOTD. This can be done by examining the scripts and configuration files in the following directories:
/etc/update-motd.d//etc/default/motd-news
Ensure that all scripts and configuration files in these directories are properly configured to disable the MOTD. If you find any files that are still generating the MOTD, update them accordingly.
Ensure the sshd\_config File is Being Read and Applied Correctly
To ensure that the /etc/ssh/sshd\_config file is being read and applied correctly, try restarting the SSH service:
sudo systemctl restart ssh
If the MOTD still displays, try reloading the SSH configuration:
sudo systemctl reload ssh
If the MOTD still displays after restarting and reloading the SSH service, double-check that the PrintMotd option is set to no in the /etc/ssh/sshd\_config file:
PrintMotd no
Clear the MOTD Cache
If the MOTD is being cached, try clearing the cache by deleting the motd.legal-displayed file:
sudo rm /var/lib/update-notifier/motd.legal-displayed
After clearing the cache, restart the SSH service and check if the MOTD is properly disabled.
In this article, we explored possible reasons why the MOTD still displays on Debian 12 systems even after updating the /etc/ssh/sshd\_config file. We provided solutions to ensure the MOTD is properly disabled, including checking for other modules or configuration files, ensuring the sshd\_config file is being read and applied correctly, and clearing the MOTD cache.