This contains information on how to actually add a banner to RHEL or Ubuntu Linux systems when logging in using ssh.
Do the following:
Locate the ssh and the sshd-config:
[xxxx@whatever ~]$ locate sshd_config
/etc/ssh/sshd_config
/etc/ssh/sshd_config.rpmnew
/usr/share/man/man5/sshd_config.5.gz
[xxxx@whatever ~]$
Edit the first file, and look for the following line:
Banner /etc/ssh/message
If the Banner-configuration is not there, just add it to the end of the configuration for the SSH deamon. You dont have to use the path we're using, obviously! ;)
Anyway, then just add something to the ssh-message, and save it. Then, restart the SSH deamon:
service sshd stop
service sshd start
Then, relog to the server and your message should appear.
The procedure is similar, however Ubuntu have defined a file you may use (I do actally think this is located in RHEL-distributions as well when I think of it..):
/etc/motd
Which, essentially, means "message of the day". This file you can edit and it will display whatever typed in there to all users that logs in to the ssh port. Remember to restart the SSH deamon services for the change to kick in!
This applies to all Linux installations, and is quite easy. Do the following:
First, we will need to disable the MOTD:
locate sshd_config
sudo vi /etc/ssh/sshd_config
In the sshd_config-file, add a comment for the following lines:
#PrintMotd yes
# or, you can add
PrintMotd no
Banner <whatever-file>
We need a file that can display some dynamic stuff. Do the following:
sudo echo "Hello there! `alias -a`" >> /etc/ssh/message-dynamic
Make it executable:
sudo chmod a+x /etc/ssh/message-dynamic
Now, we have disabled the default MOTD, and created a new script which should do the stuff we want it to do. Add the script to the startup in order to make it display stuff for users when they log in:
sudo vi /etc/profile
In that (----^) file, add the location of the message-dynamic to the last line:
/etc/ssh/message-dynamic
Quit and log back in! :)