SSH Banner
When we login to remote Linux machine, In Some machines we may see SSH banner messages printed, while we enter our username or after login.
Here we are going to see both methods, but these messages are going to be static messages only. We will talk about dynamic messages in my next post.
SSH Banner message on entering username.
For this we have to add content to the file.
/home/ec2-user/SSH_banner_message
or, we can even create a new file.
Lets place some welcome message on this file./home/ec2-user/SSH_banner_message My home directory
Once you have created file and add the content. change the permission of the file and give read permission for all users. So that who ever login to this machine can read this file. Otherwise users who doesn’t have Read permission will get error message saying Permission deniedNo read permission
Execute the below command, so that the current user will have Read and Write permission and Group and others have Read permission.
chmod 644 /home/ec2-user/SSH_banner_message
############################################################# # # # Welcome to Linux. # # Red Hat Enterprise Linux Server release 6.5 (Santiago) # # This message is printed as SSH banner message # # # #############################################################
After adding content to the file, we have to enable this file in SSHSecure Shell.
Find the following line and uncomment it
sudo vi /etc/ssh/ssh_config
#Banner none
To
Banner /home/ec2-user/SSH_banner_message
#Restart SSH
sudo service sshd restart
Once you have successfully added entry to sshd_config and restarted sshd service. Open new putty and login to view the welcome message. From the below Figure 1, you can see the SSH banner message. message is displayed after entering the user name,but before password entry. Next we will see message post password entry.

SSH Login banner message
SSH Banner message After entering password.
For this method you can revert back the changes you have done to display only one message. But here I will show you two messages also.
For displaying messages post password entry, you don’t have to make any changes to sshd_config file. But you have to place the content on specific file /etc/motd. Place the same content on the file and try to login from another terminal.

SSH banner message post login
From the above Figure 2, you can see that message is printed after password entry. Here am using the key to login, so in the Figure 2 you can see the “imported-openssh-key” before message but in the Figure 1, this is after Banner message. Check the below Figure 3, to know both the message on login.

SSH Banner message for both
For the second option, you don’t have to modify ssh. It get displayed from the /etc/motd file by default.
So far we have seen only displaying static message on the screen while login, on the next post we will look into displaying dynamic message on the screen.