Get Rewarded! We will reward you with up to €50 credit on your account for every tutorial that you write and we publish!

How to Set an SSH Login Banner on Servers

profile picture
Author
Kartik Jain
Published
2025-09-08
Time to read
4 minutes reading time

About the author- jkartik.in | Cybersecurity Enthusiast and Backend Developer

Introduction

Displaying an SSH login banner is a simple but powerful way to show any user a message before they authenticate. Everything from Cool ASCII based art to legal notices can all be served via the SSH Login Banner.

This tutorial will explain how to edit the following files:

File Purpose
/etc/issue.net Shown before login (SSH banner)
/etc/motd Shown after login (MOTD)
/etc/ssh/sshd_config SSH daemon configuration

Example Legal Banner (Compliant)

Here is an example of a banner I had spotted in real world usage recently.

NOTICE: This system is for authorized users only.
By accessing this system, you consent to monitoring and logging.
Unauthorized access is prohibited and will be prosecuted.

Prerequisites

  • Any Linux machine with root acccess
  • SSH already installed and running

Step 1 - Create the Banner File

Create a new file to hold your banner message:

sudo nano /etc/issue.net

Add your desired message. For example:

*********************************************************
  WARNING: Unauthorized access is prohibited!

  This system is monitored. All activity is logged.
  Disconnect immediately if you are not an authorized user.
*********************************************************

To make changes to the file, enter: Ctrl+O to save and Ctrl+X to exit nano.

Step 2 - Configure SSH to Display the Banner

Open the SSH daemon configuration file:

sudo nano /etc/ssh/sshd_config

Find this line:

#Banner none

And change it to:

Banner /etc/issue.net

If Banner is commented out (has a # in front), remove the #.

Step 3 - Restart SSH

To apply the changes, restart the SSH service by:

sudo systemctl restart ssh

If you're connected via SSH, don't close your session until you confirm the config works. Restarting ssh incorrectly could lock you out.

Step 4 - Test the Banner

From another terminal, SSH into your server:

ssh user@server

You should now see the banner message before being prompted for your password or key.

Step 5 - Setup for a Post-Login Message (MOTD)

If you want to show a message after a successful login, edit the MOTD file:

sudo nano /etc/motd

Example content:

Welcome to depths that only a few can approach, your Hetzner server!
Remember to update your packages regularly.

This message will be shown after login but before the shell prompt.

Conclusion

You’ve successfully set up an SSH login banner on your server. This adds a cool look or a legal notice on your server when logging in.

References:

License: MIT
Want to contribute?

Get Rewarded: Get up to €50 in credit! Be a part of the community and contribute. Do it for the money. Do it for the bragging rights. And do it to teach others!

Report Issue

Discover our

Dedicated Servers

Configure your dream server. Top performance with an excellent connection at an unbeatable price!

Want to contribute?

Get Rewarded: Get up to €50 credit on your account for every tutorial you write and we publish!

Find out more