Why does my ssh login include what looks like a promotion for a TechRepublic article?
In this file:
/etc/pam.d/sshd
Comment out the following 2 lines:
# session optional pam_motd.so motd=/run/motd.dynamic
# session optional pam_motd.so noupdate
This should remove the MOTD.
Another approach is to specify ENABLED=0
in the config file /etc/default/motd-news
. This may be preferred, based on a review of /etc/update-motd.d/50-motd-news
:
$ grep -A5 Source /etc/update-motd.d/50-motd-news
# Source the local configuration
[ -r /etc/default/motd-news ] && . /etc/default/motd-news
# Exit immediately, unless we're enabled
# This makes this script very easy to disable in /etc/default/motd-news configuration
[ "$ENABLED" = "1" ] || exit 0
You can update /etc/default/motd-news
in your editor of choice, or use sed or perl. Note that root privileges are required:
sudo sed -i -e 's/ENABLED=1/ENABLED=0/' /etc/default/motd-news
The link to the TechRepublic article is coming from the output of this script, which is executed for each login:
/etc/update-motd.d/50-motd-news
You can disable just that script by removing execution permissions:
sudo chmod -x /etc/update-motd.d/50-motd-news