Display SSH Warning Message to Users

By | January 30, 2014

warning iconOne of the easiest way to alert unauthorized people that they are trespassing when they try to access the SSH of your server (maybe by mistake) is to add a warning message before and/or after login.

Of course, this does not mean that your server is secure when you add it, but at least they have been warned.

How to add a warning message before SSH login

First you will need to create a file with your message. For example:

vim /etc/ssh/sshd_banner

You can add the message you want, for example:

*************************************************************
WARNING - PRIVATE ELECTRONIC DEVICE - ACCESS PROHIBITED
This device is a private network device. Access to this device is
not authorized. Any attempt for unauthorized access will be logged.
*************************************************************

Add in the SSH daemon configuration the banner option:

vim /etc/ssh/sshd_config

Add at the end of the file:

Banner /etc/ssh/sshd_banner

How to add a warning message after SSH login

Just add the text you want in /etc/motd:

vim /etc/motd

You can add the message you want, for example:

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

Next time someone tries to log in it will look like this:

*************************************************************
WARNING - PRIVATE ELECTRONIC DEVICE - ACCESS PROHIBITED
This device is a private network device.  Access to this device is
not authorized.  Any attempt for unauthorized access will be logged.
*************************************************************
[email protected]'s password: 
Last login: Thu Jan 30 08:08:45 2014 from 127.0.0.1
 __      __       .__                               
/  \    /  \ ____ |  |   ____  ____   _____   ____  
\   \/\/   // __ \|  | _/ ___\/  _ \ /     \_/ __ \ 
 \        /\  ___/|  |_\  \__(  <_> )  Y Y  \  ___/ 
  \__/\  /  \___  >____/\___  >____/|__|_|  /\___  >
       \/       \/          \/            \/     \/

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.