How to show a welcome message after SSH login on Ubuntu

s2 0

If you want to allow remote access to your system via SSH, you want a customized message to be displayed on the terminal for the remotely logged on user. This news is often referred to as the news of the day. In this tutorial, I’ll show you how to view a custom text message when you log in to SSH on your Linux server. I used Ubuntu 20.04 for this tutorial, but the same steps should work on other Linux distributions as well.

requirements

You need to have SSH installed.

View a message of the day on Ubuntu

To see the news of the day in Linux, you need to do the following:

Step # 1: Create a File of the Message of the Day

First, you need to create a Message of the Day or MOTD file on your system using the command shown below:

$ sudo nano /etc/motd

Once this file is created you can enter any message of your choosing, just like we did. You can then save this file and exit your respective text editor.

Step # 2: Check your system’s IP address

The second step is to check your system’s IP address which you can easily do by running the following command:

$ ip a

Get the IP address

The IP address of our Linux system is highlighted in the following figure:

System IP address

Step 3: Sign in to your computer via SSH to view the message of the day:

Now you need to log into your computer via SSH by running the following command. You can either run this command on your own computer’s terminal or even use another computer on the same network for the same purpose.

$ ssh 10.0.2.15

Log in via SSHadvertising

Since this is the first time we have executed this command, we have been asked for a confirmation, which we highlighted by entering “yes” as shown in the following figure:

Accept fingerprint

After that we were asked to enter the password of our Linux Mint 20 system as shown in the following figure:

Enter password

After we entered our password, the message of the day was displayed on our terminal as highlighted in the following figure:

Message displayed at SSH login - message of the day

diploma

This makes it easy to create a custom message file on your Ubuntu system to display a message of the day of your choice when a user logs into your system remotely via SSH.

How to show a welcome message after SSH login on Ubuntu
Tags: