Whenever you log in to your remote server running on Ubuntu via SSH, you encounter the following SSH welcome screen:
This screen is usually shown to users when they connect to a server running on Ubuntu or any other Debian-based distribution.
It's acceptable to have it for a while, but eventually, dealing with a large chunk of SSH welcome text every time you connect to your server becomes annoying.
So, in this guide, you will learn how to disable the SSH welcome message on your Ubuntu system.
How to Disable SSH Welcome Message on Ubuntu
The SSH welcome message are shown from the files located at /etc/update-motd.d/
path and settings defined in the /etc/ssh/sshd_config
file.
To suppress a welcome message, begin by opening your terminal and modifying the /etc/ssh/sshd_config
file with your preferred text editor.
- sudo vim /etc/ssh/sshd_config
Once the file is opened, find the PrintMotd
field and set its value to no
.
Save and close the file, then proceed to edit the /etc/pam.d/sshd
file.
- sudo vim /etc/pam.d/sshd
Then find the following two lines:
session optional pam_motd.so motd=/run/motd.dynamic
session optional pam_motd.so noupdate
Once you locate them, comment them down by placing #
in front of each line, as shown:
# session optional pam_motd.so motd=/run/motd.dynamic
# session optional pam_motd.so noupdate
The following is the look of the file after commenting on the above two lines:
Save and close the file, restart your SSH server by running the following command:
- sudo systemctl restart ssh
After completing the task, attempt to connect to your remote server, and you'll notice that this time you won't receive a welcome message, as shown:
Avoid Doing This
Some solutions on the internet might suggest you delete all the content that resided within the /etc/update-motd.d/
directory, but this is not a good practice as it removes the option for you to undo it in the future if you want it back.
Another solution might be to remove executable permission from all the content in the same update-motd.d
directory, which is again not recommended as playing with file permission has never been a good approach.
So, I suggest you follow only the methods suggested in this article, and when you want your welcome screen back, simply uncomment the commented lines, and you are good to go.