How to Show Welcome Message to Logged SSH Users

In a previous article, we showed you how to display a warning message banner for an unauthorized SSH user. Today, you are about to learn how to display a welcome message after authorized or unauthorized users log into the system.

But why is it important for you to show a welcome message after users log into the system? The answer is pretty simple many times in an organization, or if you have a SASS product that involves an SSH server, then most probably you want to instruct the user via the login screen.

At the same time, you can show the user what kind of data is being logged, like an IP address, time, system information, etc., as shown below.

Showing welcome message on user login to SSH server
Showing welcome message on user login to SSH server

Note that if you have added a warning message before an authorized or unauthorized user logs into the system, that will also be displayed, as shown below.

Warning and welcome when the user logs in to the SSH server
Warning and welcome when the user logs in to the SSH server

I hope you now understand what we were intending to do, so let’s break this down into steps.

How to Show a Welcome Message to Logged SSH Users

To show the welcome message to logged-in SSH users, you need to edit the motd (Message of the Day) file and add the content of your welcome message, and that’s all.

Let’s see each of these in step-by-step procedure.

First open the “/etc/motd” (if not exists than create a new one) file using your choice of text editor.

trendoceans@linux:~$ sudo vim /etc/motd
OR
trendoceans@linux:~$ sudo nano /etc/motd

Than add the following banner for showing the welcome message to logged-in users.

###############################################################
#                       				      #
#                  	     Welcome                          #
#       All connections are monitored and recorded.           #
#  Disconnect IMMEDIATELY if you are not an authorized user!  #
#  							      #
###############################################################

The following is the output after adding the above banner on “/etc/motd” file.

Motd file
Motd file

Lastly, save and close the file.

Now, when any authorized or unauthorized user successfully logs into the SSH server system, they will get the following welcome (with a little bit of warning) message.

Showing welcome message on user login to SSH server

That’s all for now. Finally, like always, if you have any question or encounter any error, then do let us know in the comment section.

Leave a Reply