Change SSH Login Message

When you SSH in to your server, one of the things you notice is the mass of text that greets you upon successful logon. There is some useful information there, like server load, storage usage and whether any packages can be updated. There is unfortunately though, a lot of advertising and less useful information. While you can get used to it, I got tired of it taking up the whole of my screen as soon as I logged on.

Having a block of text greet a user as they log on is common on command line interfaces. This is known as the ‘motd’, or Message of the Day. You will often see this if you log onto command lines for servers, routers, network devices, etc, and is often used to highlight legal warnings or corporate messages to a user.

To disable the motd for SSH sessions to your server, go to /etc/pam.d and make a backup copy of the file called sshd:

cd /etc/pam.d
sudo cp sshd sshd.BACKUP

Then edit the file (sudo nano sshd) and comment out the two lines below by adding a # mark at the start of the line, as below:

#session    optional  motd=/run/motd.dynamic
#session    optional noupdate

Save and exit (Ctrl + O; Ctrl + X) and log out of the SSH session. When you next log in again you should see a much leaner motd, which just shows the last login date for your user.

Next Steps

There was some useful information in the original motd, though it wasn’t worth the amount of space which the overall message took up. The next step will be to find out how we can change, rather than remove, the motd so that it shows you just the useful info and none of the rest. I will be back to update this article once I have this tied down.

You have successfully subscribed

There was an error while trying to send your request. Please try again.

Linux Home Server will use the information you provide on this form to be in touch with you and to provide updates and marketing.

Sign up to be notified of updates and new articles. Tell me also what you want to know more about?