Enabling Custom SSH Banner in Linux 


We can enable custom banner which user can see when they login via SSH.


Steps:


1) Banner is by default disabled in sshd.

2) Login as the root user and create a custom login banner file:

# vi /etc/ssh/sshd-banner

Enter a Custom Text like below

Welcome to Himanshu's Server Remote Login!

3) Open sshd configuration file /etc/sshd/sshd_config using a text editor:

# vi /etc/sshd/sshd_config

4) Add/edit the following line:
Uncomment Banner line and put your custom banner file path.
# no default banner path
Banner /etc/ssh/sshd-banner


5) Save file and restart the sshd server:

# /etc/init.d/sshd restart
or
#service sshd restart
6) Test your new banner by trying to login using ssh

$ ssh bob@lfcs.lab