Information Banner on Ubuntu

This is the week I am writing about something that very common, and the reason behind this post is that I was running out of time to work on new stuff I found interesting. But keep the promise for the next post I will bring something interesting. Lets start.

Searching through the Linux file system I came across an ssh login banner. Wondering on how-tos, stuck me upon this post. It is simple as a warning message before the user login to the system.

Note: Tested on Ubuntu

How to do it?

  • Let’s make a file named issue.net. FYI you can name it anything.
vi /etc/issue.net
  • Type the message you want to display.
ALERT! You are entering into a secured area! Your IP, Login Time, Username has been noted and has been sent to the server administrator!
This service is restricted to authorized users only. All activities on this system are logged. Unauthorized access will be fully investigated and reported to the appropriate law enforcement agencies.
  • Open an ssh configuration file.
vi /etc/ssh/sshd_config
  • Look for the word “Banner” and uncomment it and set path to issue.net file.
Banner /etc/issue.net
  • Now restart the ssh daemon.
sudo /etc/init.d/sshd restart

Now the other most obvious thing that I am unwillingly willing to write about is to display banner after user login.

Here is How to do it?

  • Go to directory /etc/update-motd.d/.
cd /etc/update-motd.d
  • Add new file caller 01-custom.
vi 01-custom
  • Add content in it. Remember this will be in script format.
echo "This is banner"
  • Make the script executable.
sudo chmod +x /etc/update-motd.d/01-custom
  • Remember you can always change default scripts as well. Just poke around.

Reference

https://www.shellhacks.com/setup-warning-message-banner-ssh/

https://linuxconfig.org/how-to-change-welcome-message-motd-on-ubuntu-18-04-server

https://www.tecmint.com/protect-ssh-logins-with-ssh-motd -banner-messages

For help with any Linux project: x786@protonmail.ch

Leave a Comment