Banners can be placed in two places, before the login and after successful login.  Usually people keep warning messages or banners before login and welcome messages or banners after the login.

Messages before login are configured in the sshd configuration and the welcome messages/banners configured after login are configured in the motd configuration.

How to configure Warning Messages / Banners before the login

These messages are configured using the sshd configuration. Usually system administrators keep these messages in a file called issue.net and configure the file location in the sshd configuration. In this example, I am going to keep an issue.net file in /etc/issue.net location (By default this file exists in some of the operating systems)

nano /etc/issue.net
WELCOME TO AMALGJOSE.COM. 

ALL THE ACCESS ARE TRACKED AND RECORDED

IF YOU ARE NOT THE AUTHORIZED USER, PLEASE DISCONNECT IMMEDIATELY

Now save the issue.net file and open SSHD configuration file.

nano /etc/ssh/sshd_config

Search for the keyword Banner in the sshd_config file. You may see a line something like the one below.

#Banner none

Now uncomment the line and instead of none, specify the banner file name with the path. In our case, it will be like the line below.

Banner  /etc/issue.net

Now save and close the sshd_config file and restart the sshd service

service sshd restart

(Note: Instead of restart, you can also do a reload to avoid the disconnection of existing connections)

Now try to login to the linux machine using putty. After entering the username, you will see the configured message on the screen.

sshd_banner

You can format this message based on your wish. You can also add ascii-arts to the issue.net file and create fancy messages. The details about generating ascii art messages are explained in my previous post.

Now we will discuss about the configuration of messages that shows up after the login. Usually this will be a welcome message/banner.

How to configure Messages / Banners after the login ?

The messages that shows up after successful login are usually welcome messages. This is configured in a different file.  The file name is motd. This file is located in the location /etc/motd

Edit the file and add the required contents to the file. After that save and close the file. Sample contents are given below.

nano /etc/motd
#####################WELCOME TO AMALGJOSE.COM#############################

DO NOT STORE ANY CRITICAL FILES IN THIS SERVER AS THE DISKS WILL BE CLEARED FREQUENTLY

You can also add ascii arts into this file. In this example I have used a simple text content.

Now after saving the file, logout and login again. You will be able to see the message.

motd_banner_1

All set…!!!. Hope this information helps you.

Advertisement