🕵️‍♂️ How to display banner / message before OpenSSH authentication

Want to display a message or banner before OpenSSH authentication (SSHD server)?

Try this simple trick to show an ASCII banner or logo on your Linux or Unix system.

OpenSSH has a built-in configuration option called Banner.

The contents of the specified file are sent to the remote user before authentication is allowed.

If the “banner” parameter is set to “no”, then no banner is displayed when using the ssh command or client.

By default, no banner is displayed and this setting is disabled.

You can also post a legal notice if required by local law.

see also:

How to set up your banner in Metasploit

How to display banner / message before OpenSSH authentication

  • Log into the remote Linux and Unix server.
  • Edit the file / etc / ssh / sshd_config.
  • Add / change configuration parameter. For example: Banner / etc / ssh / my_banner
  • Save and close the file.
  • Make sure you create a new file called / etc / ssh / my_banner file.
  • Restart the sshd service. For instance:

# Linux #
sudo systemctl reload ssh.service
# FreeBSD #
sudo /etc/rc.d/sshd restart
# OpenBSD #
doas /etc/rc.d/sshd restart

Example banner / message file for sshd

Here is my file:

$ cat /etc/ssh/my_banner

Output:

.__  __                        _____                   
|__|/  |_  ______ ____   _____/ _______________ __ __ 
|     __/  ___// __ _/ ___   __/  _ _  __   |  
|  ||  |  ___ \  ___/  ___|  | (  <_> )  | /  |  /
|__||__| /____  >___  >___  >__|  ____/|__|  |____/ 
              /     /     /

Testing Let’s test our SSH client. It is a program for logging into a remote computer and for executing commands on that system. As you know, ssh server and client provide secure encrypted communication between two untrusted hosts on an insecure network like LAN or Internet. Use your favorite search engine and enter:

ASCII art

Another option is to use the figlet command to display large characters composed of normal screen characters. We also have a toilet command that prints out text using large characters composed of smaller characters. It is similar to a FIGlet with additional features such as Unicode handling, color fonts, filters, and various export formats. For instance:

$ figlet nixCraft
$ toilet -f mono12 -F metal itsecforu
# figlet itsecforu > /etc/ssh/my_banner

Sidebar