Custom banner message for SSH in Ubuntu 9.04
by Adam on Jan.05, 2010, under Linux, Ubuntu 9.04
This tutorial will probably work for any distro with OpenSSH installed.
Normally, when you log into SSH on you Ubuntu PC, you’ll just see a prompt for the login and password.
password:
But there is a way that you can get a bit of text to show after a user enters their login name.
there is a file called /etc/issue.net. Edit this file with your favorite text editor, nano, pico, whatever, and insert whatever you want to show after a user enters their username. It’s typically used as a disclaimer against people trying to gain unauthorized access. Something like “Unauthorized attempts at access are prohibited.”
The reason this method is used is because it will show even on unsuccessful logins or usernames that don’t really exist. You wouldn’t want to place the disclaimer in the motd file, since that would only show if someone actually got logged in.
So anyhow, edit the file.
You’ll need to use sudo, because the file is owned by root, and can only be written to by root. Once in nano, enter the message you want to appear on SSH login attempts and save the file.
Now you’ll need to edit the /etc/ssh/sshd_config file to tell ssh which banner file to use. It may already be set up to use issue.net, but check to make sure.
The line you are looking for is Banner /etc/issue.net. It might be commented out with a # in front, if it is, remove the #, and make sure the line appears as above.
Now to reload the config you need to restart SSH.
Subsequent attempts to log in with SSH should look like this now:
–== FooBuntu ==–
–== Unauthorized attempts at access are prohibited. ==–
adamsmash’s password: