How to setup a banner for SSH clients to see when they login

Valic —  March 26, 2013 — Leave a comment

It is possible to configure logon or welcome banner in the SSH server with the use of the Banner directive in /etc/ssh/sshd_config file.The Banner directive is only available for SSH protocol version 2 and by default there are no banner configured.

1. Create a banner file.

First you need to create the file that will include your banner for your users. In Debian, the default banner is located in /etc/issue.net file

nano /etc/issue.net

You can put here anything you want or just a welcome message like this:

###############################################################

Welcome to my server!
Disconnect IMMEDIATELY if you are not an authorized user!

###############################################################

2. Configure the /etc/ssh/sshd_config file

Now, add or remove the # from the beginning of the line Banner /etc/issue.net from /etc/ssh/sshd_config file.

nano  /etc/ssh/sshd_config
Banner /etc/issue.net

Restart sshd daemon for the changes to take effect

/etc/init.d/ssh restart
[ ok ] Restarting OpenBSD Secure Shell server: sshd.

3. Testing the Banner

Next time when you are accessing server using ssh the banner message will appear as follows:

root@server:~# ssh root@debian-tutorials.com
###############################################################

Welcome to my server!
Disconnect IMMEDIATELY if you are not an authorized user!

###############################################################
root@debian-tutorials.com's password:

Valic

Posts Twitter Facebook

Editor in Chief at Debian-Tutorials, Linux enthusiast.

No Comments

Be the first to start the conversation.

Leave a Reply