December 23, 2024
Editing the banner file for ssh logins

One of the earlier posts described how to install SSH server on Ubuntu. Now, it may be necessary to set a banner for legal as well as for clarity purposes that any user who logins remotely to this server can view and understand (similar to usage agreement when installing apps).

Here is how to set a warning banner that is displayed when anyone can see when they login via SSH :

1. First  open the sshd_config file by typing :

nano /etc/ssh/sshd_config

2. Next, find and remove the # next to the line :

#Banner /etc/issue.net

so that it looks like :

Banner /etc/issue.net

Save these changes to file and exit the text editor.

3. Now the banner file needs to be changed so that any appropriate message can be displayed, this file is located at /etc/issue.net, so edit it using any text editor like nano or vim :

nano /etc/issue.net

Editing the banner file for ssh logins

A sample and much more serious warning banner 🙂 can be something like this :

-------------
W A R N I N G
-------------
THIS IS A PRIVATE COMPUTER SYSTEM.
This computer system including all related equipment, network devices (specifically
including Internet access), are provided only for authorized use. All computer systems
may be monitored for all lawful purposes, including to ensure that their use is
authorized, for management of the system, to facilitate protection against unauthorized
access, and to verify security procedures, survivability and operational security.
Monitoring includes active attacks by authorized personnel and their entities to test or
verify the security of the system. During monitoring, information may be examined,
recorded, copied and used for authorized purposes. All information including personal
information, placed on or sent over this system may be monitored. Uses of this system,
authorized or unauthorized, constitutes consent to monitoring of this system.
Unauthorized use may subject you to criminal prosecution. Evidence of any such
unauthorized use collected during monitoring may be used for administrative, criminal or
other adverse action. Use of this system constitutes consent to monitoring for these
purposes.

4. Finally, for these changes to take effect, restart the ssh service :

sudo /etc/init.d/ssh restart

All done!

So next time when anyone tries to login via SSH, the banner will be displayed.

Warning banner during login

Cheers.

 

By admin

Related Post