Warnings and Welcome Banners

A personalized SSH banner is fun. But also most companies have them. It is easy to do the banner. So follow this quick guide and you have one.

Warnings and Welcome Banners

To display a welcome or warning message for SSH users before signing in. Use a file like issue.net or sshd-banner to display a warning banner. This is an area often forgotten in system protection, a well-formed banner text. SSH warning banners and welcome messages are necessary when organization wishes to prosecute an unauthorized user or just give out some information or announcement.

SSH Warnings Banner – before Login

Pre-login SSH warning banner shows before the password prompt. It usually uses for legal warnings to establish the terms and conditions by which someone is allowed to use the system.

The SSH warning banners are commonly located in the files /etc/issue and /etc/issue.net, but you can also use your custom file like /etc/ssh/sshd-banner. The content of the specified file is sent to the remote user before authentication.

We need to edit the sshd config file /etc/ssh/sshd_config and add the pre-login banner file of our choice.

Locate #Banner none and replace or append the line with banner /etc/issue.net or /etc/ssh/sshd-banner that line defines the pre-login banner file.

Create the actual Warnings Banner

Start by nano /etc/issue.net, this file can hold anything you like, or you make it as per your organization policy.

       __        ___    ____  _   _ ___ _   _  ____
       \ \      / / \  |  _ \| \ | |_ _| \ | |/ ___|
        \ \ /\ / / _ \ | |_) |  \| || ||  \| | |  _
         \ V  V / ___ \|  _ <| |\  || || |\  | |_| |
          \_/\_/_/   \_|_| \_|_| \_|___|_| \_|\____|

Unauthorized access to this system is forbidden and will be
prosecuted by law. By accessing this system, you agree that 
all your actions may be monitored if unauthorized usage is 
suspected. You have been warned.

###############################################################
#                  _    _           _     _                   #
#                 / \  | | ___ _ __| |_  | |                  #
#                / _ \ | |/ _ \ '__| __  | |                  #
#               / ___ \| |  __/ |  | |_  |_|                  #
#              /_/   \_\_|\___|_|   \__  (_)                  #
#                                                             #
#  You are entering a secured area!                           #
#                                                             #
#  Your IP, Login Time and Username has been noted and        #
#  has been sent to the server administrator!                 #
#                                                             #
#  This service is restricted to authorized users only.       #
#  All activities on this system are logged.                  #
#                                                             #
#  Unauthorized access will be fully investigated and         #
#  reported to the appropriate law enforcement agencies.      #
###############################################################

AND

Restart SSH

service sshd reload

SSH Welcome Message – after Login

The content of the file /etc/motd is displayed after successful authentication, but just before the shell. It is used for system announcements and other important information, that you want authenticated users to know about before they start using the system.

Edit the file nano /etc/motd and place the announcement message and save.
This message will be shown after the successful authentication through SSH.

As an example,

[email protected]'s password:
Linux pve-3 6.8.12-8-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-8 (2025-01-24T12:32Z) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.


 .d8888b.  8888888b.  888     888        888888888  888888888  
d88P  Y88b 888   Y88b 888     888        888        888        
Y88b.      888    888 888     888        888        888        
 "Y888b.   888   d88P Y88b   d88P        8888888b.  8888888b.  
    "Y88b. 8888888P"   Y88b d88P              "Y88b      "Y88b 
      "888 888 T88b     Y88o88P   888888        888        888 
Y88b  d88P 888  T88b     Y888P           Y88b  d88P Y88b  d88P 
 "Y8888P"  888   T88b     Y8P             "Y8888P"   "Y8888P"  
 

Last login: Tue Feb  4 17:30:06 2025 from 192.0.2.161