How to change banner / welcome message, ssh server shows at login time.
Follow @ggarron
Introduction
Opensshd has a nice feature, that lets you present a welcome message to users who are login in to the Linux server. This feature is useful if you need to present a warning or any other message to users before they log into the system.
A good example could be something like this message:
“Please be responsible while you are logged into this server, any bad action will be recorded, and legal actions will taken”
How to enable sshd banner
First you need to create the Banner that will be displayed by ssh server. So create a file that will have that banner.
vim /etc/ssh/ssh-banner-message.txt
You may use any other text editor, I like vim.
There you can add the message, let’s follow the example above:
Please be responsible while you are logged into this server, any bad action will be recorded, and legal actions will taken
Now configure sshd to show your banner to users trying to log into the server.
Edit the file /etc/ssh/sshd_config
vim /etc/ssh/sshd_config
Look for this line, or create if none exists.
Banner /etc/ssh/ssh-banner-message.txt
Of course you can point Banner to any other file, where you have the message to want to be displayed.
Now, restart Opensshd
/etc/rc.d/rc.ssh restart
For Slackware users.
/etc/rc.d/sshd restart
For Arch Linux users.
/etc/init.d/sshd restart
For Debian/Ubuntu users.
Test sshd banner
Log into your own computer you can do it from the same server.
ssh localhost
You should see something like this:
bash-4.1$ ssh localhost Please be responsible while you are logged into this server, any bad action will be recorded, and legal actions will taken ggarron@localhost's password:
You are done.