Here is how to add SSH message before login, so that all can see message after running SSH login command before the password prompt appears. This guide is basically written for Deb based Linux, but will work on any UNIX or unix like OS after slight modification. Previously, we have discussed How To Change SSH Welcome Message, that was actually Message of the Day (MOTD). If we want to add any message before login, then the work must have to be associated with SSH Daemon – it is the sshd
which handles the request ssh root@IP-Address
and throws the password prompt. If for some wrong configuration, sshd
does not restart – you can get fully locked in and in case of a true Dedicated Server, it can be quite difficult to get back right without the help of people inside the data center with KVM.
Add SSH Message Before Login
If you add SSH message before login, it has legal importance – it is like showing the warning – “Trespassers Will Be Prosecuted”. This is called Pre login banner (OBS) instead of MOTD banner and available on all latest Linux and UNIX systems. Computer Misuse Act 1990 and Regulation of Investigatory Powers Act 2000 mandates the implementation of this banner. There is FTP Warning Banner available too. These are related to Network Login and very few actually will ever try to login without permission. OBS By default is this disabled in ssh.

Add SSH Message Before Login : A Typical Example Which You Can Copy
This is a standard warning message, you can use it if you want. At least; this is good for first test.
---
1 2 3 4 5 6 7 8 9 10 11 | ******************************************************************** * * * This system is for the use of authorized users only. Usage of * * this system may be monitored and recorded by system personnel. * * * * Anyone using this system expressly consents to such monitoring * * and is advised that if such monitoring reveals possible * * evidence of criminal activity, system personnel may provide the * * evidence from such monitoring to law enforcement officials. * * * ******************************************************************** |
Add SSH Message Before Login : Steps For Debian and Ubuntu
First, login as root
user and open the sshd configuration file (this is where you can do mistake) :
1 | nano /etc/ssh/sshd_config |
Use the keyboard direction keys to scroll down to find this line :
1 | # Banner /etc/issue.net |
Remove the hash / uncomment it. Write out with O + W and exit with ^ + X. Next, we need to edit the /etc/issue.net
file itself :
1 | nano /etc/issue.net |
Remove any default Ubuntu/Debian version text and copy paste things you want. Restart SSH :
1 2 3 | service ssh restart # or /etc/init.d/sshd restart |
On next login you’ll get the warning.
Add SSH Message Before Login : CentOS / Red Hat
Same like above, only the file /etc/issue.net
might not exist.
Add SSH Message Before Login : Need More?
Here is a standard way to generate images and lot of creative ideas :
1 | http://www.deater.net/weave/vmwprod/linux_logo/ |