How to Display a Welcome Message after SSH Login on Ubuntu

Logging in via SSH is one of the most common ways by which you will be able to manage a remote server. If a server is managed by an entire team of professionals, then it may be convenient to leave a welcome message after SSH Login with whatever you want.

SSH is a remote administration protocol that allows users to control and modify their remote servers over the Internet. However, it is primarily intended for connecting to machines that we access via the command line.

So for using the command line of a Linux server there is nothing better than SSH. Despite the importance of, the application can leave custom messages after logging. This may seem silly, but it is quite useful when a work team manages a specific server.

Display a Welcome Message after SSH Login on Ubuntu

The easiest way to do this is with the Message of the Day utility, which is handled by the /etc/motd file.

So, first edit the file yourself

sudo nano /etc/motd

Inside this file, you can place the message you want to give. For example,

Welcome to ImagineLinux tutorial! Enjoy it!

Of course, you can contain anything you want.

Save the changes and then close the editor.

For this to work, you need the PrintMotd value to be yes in the SSH configuration file.

So, edit the SSH configuration file:

sudo nano /etc/ssh/sshd_config

And change the value of PrintMotd like this

PrintMotd yes

Save the changes and restart SSH.

sudo systemctl restart sshd

Now when you log in again, you should see the message

Welcome Message on SSH
Welcome Message on SSH

Another method to display messages in SSH

Although the above method is effective and meets most of the above needs, there are more experienced users who need additional information to display in the message. The solution then is to create your own script to place the message in.

First create a script where you can display messages, variables, and the information you want. Create the file with a name that has this syntax.


Where xx are two numbers that set the priority at login time. Then - and then the name you want. This file must not contain any extension.

nano 50-message

And inside something like


hostName=`uname -n`
kernel=`uname -r`

echo "
 - Hostname............: $hostName
 - Kernel Version.........: $kernel
echo "Welcome"

As you can see, it can be a bit more complex. Here I only show the kernel version, the hostname and a message.

Now copy it to the MOTD directory with run permissions.

chmod +x 50-message
cp 50-message /etc/update-motd.d/

When you log in again, you will get the desired message.

Message after SSH Login
Message after SSH Login

So, you did it, now you know how to set messages for users logging in via SSH.


Custom messages in SSH can be very useful when sharing computer administration. That’s why it’s important to know how to use them and be able to do so.

I hope you liked this post and help us to spread it.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top