Home Linux How to add SSH Welcome Banner

How to add SSH Welcome Banner

713
0
SHARE

A fun way to ward off unauthorized users attempting to login through SSH is by displaying a message and we will show you how to add SSH welcome banner by editing a couple files.

SSH banners are common with system administrators when they are configuring Linux servers. These security banners normally let a user know that all actions are monitored and that logging in is for authorized access only. These banners may contain contact information as well.

HOW TO ADD SSH WELCOME BANNER BEFORE LOGIN

First you will need to be logged in via SSH or logged into the operating system itself. Either through SSH or through a terminal session you will need to edit the issue.net file. You can open this file by using typing:

nano /etc/issue.net

This file is responsible for displaying a message to a user before they login via SSH. When you have they file open you can paste the contents of your message.

###############################################################
#                     Welcome to D3PHACE                      #
#                   Authorized access only!                   # 
# Disconnect IMMEDIATELY if you are not an authorized user!!! #
#        All actions Will be monitored and recorded           #
###############################################################

When you are happy with your message you need to save the file by typing “Ctrl+x“, then “y“, then “Enter“.

Now that you have the “issue.net” file saved you will need to make some changes to the master SSH configuration file to enable the SSH banner.

HOW TO ADD SSH WELCOME BANNER – ENABLING THE BANNER

To enable the SSH banner feature you will need to edit the “sshd_config” file. Use the following command to open it:

nano /etc/ssh/sshd_config

When you have the file open you need to scroll down until you see:

#Banner /etc/issue.net

Remove the hash to ensure that it isn’t commented out. It should look like this:

Banner /etc/issue.net

Then save and exit the file by typing “Ctrl+x“, then “y“, then “Enter“. Now you need to restart SSH by using the following command:

service ssh restart

Now exit your current session or start a new one and connect to the server. You should see that the banner message you created is displayed.

How to add SSH Welcome Banner - Before Login

HOW TO ADD SSH WELCOME BANNER AFTER LOGIN

Learning how to add SSH welcome banner after a user logs in is as simple as editing the “motd” file. To open this file type the following:

nano /etc/motd

Now copy and paste your banner message into this file and save it using “Ctrl+x“, then “y“, then “Enter“.

###############################################################
#                     Welcome to D3PHACE                      #
#                   Authorized access only!                   # 
# Disconnect IMMEDIATELY if you are not an authorized user!!! #
#        All actions Will be monitored and recorded           #
###############################################################

Now exit your session or start a new one and login. You should notice that both banners are displayed.

How to add SSH Welcome Banner - Before and After Login

LEAVE A REPLY

Please enter your comment!
Please enter your name here