• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How To Create A SSH Banner in CentOS/RHEL Server

By admin

Note: Please do not put any classified information in a banner file since banner message is displayed before entering user/password credential during ssh/scp session.

1. Create the text file that should appear as the warning. For example /etc/sshbanner.txt:

[root@server]# vi /etc/sshbanner.txt

###############################################################################################################################################################
#
#  WARNING TO USERS OF THIS SYSTEM
#
#  THIS IS A NOTICE OF LINUX DEPARTMENT
#
#  HOW TO CREATE  A SSH BANNER IN LINUX SERVER
#
###############################################################################################################################################################

2. Add the location of your banner into configuration file /etc/ssh/sshd_config as shown below:

[root@server]# grep -i banner /etc/ssh/sshd_config
# no default banner path
Banner /etc/sshbanner.txt

3. Restart the SSHD Daemon:

[root@server]# /etc/init.d/sshd restart
Stopping sshd:                                             [  OK  ]
Starting sshd:                                             [  OK  ]
[root@sserver]#

4. Try to login by ssh again to the server:

[root@server]#  ssh server.ip.or.hostname
###############################################################################################################################################################
#
#  WARNING TO USERS OF THIS SYSTEM
#
#  THIS IS A NOTICE OF LINUX DEPARTMENT
#
#  HOW TO CREATE  A SSH BANNER IN LINUX SERVER
#
###############################################################################################################################################################

root@server.ip.or.hostname password:
Last login: Mon Jan 25 05:44:43 2021 from server.ip.or.hostname
[root@server]#

Filed Under: CentOS/RHEL, Linux

Some more articles you might also be interested in …

  1. CentOS / RHEL 7 : Lock User Account After N Number of Incorrect Login Attempts
  2. CentOS / RHEL 6 : How to password protect grub (Password-Protected Booting)
  3. Slow SSH login due to unreachable rsyslog server
  4. How to Configure Multiple MySQL Servers On One System Using mysqld_multi
  5. How to Recover from a Corrupted or empty /etc/mtab file in CentOS/RHEL 7
  6. How to recover from a corrupt RPM database (rebuilding an RPM database)
  7. Linux OS Service ‘rpcidmapd’
  8. lvcreate/lvremove Failed with Error “Can’t remove merging snapshot logical volume”
  9. Beginners Guide to DHCP – Install and configure DHCP server and client
  10. How to change the default IP address of docker bridge

You May Also Like

Primary Sidebar

Recent Posts

  • SQL script to find tables that are fragmented
  • TRUNCATE TABLE not releasing space from tablespace
  • How to reclaim entire space of an oracle database table with “Truncate Table” statement
  • Oracle SQL Script to Report Tablespace Free and Fragmentation
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary