Save 15% on Instant Deploy Bare-Metal Servers in 26 Global Markets with Coupon Code: EdgeSave

How can I display a banner when someone attempts to ssh to my server?

This can be set with the Banner directive in sshd_config.

First create a banner to display upon connection:

root@root [~]# vi /etc/sshd_banner.txt
Set the Banner directive to point to this file and restart sshd:
root@root [~]# cd /etc/ssh/
root@root [/etc/ssh]# cp sshd_config
root@root [/etc/ssh]# vi sshd_config
root@root [/etc/ssh]# diff sshd_config
< Banner /etc/sshd_banner.txt

> #Banner /some/path
root@root [/etc/ssh]# /etc/init.d/sshd restart
Stopping sshd:                                             [  OK  ]
Starting sshd:                                             [  OK  ]
Test your new configuration:
root@root [/etc/ssh]# ssh

This is a test banner.
Your message/warning etc here.

root@’s password:

Share on Twitter
Share on Facebook