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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • 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. ldconfig Command Options
  2. killall Command Examples in Linux
  3. csv2tsv: Convert CSV (comma-separated) text to TSV (tab-separated) format
  4. Basic nano Commands (Cheat Sheet)
  5. ark Command Examples in Linux
  6. dpkg-reconfigure Command Options
  7. How does “chmod -R 755” works
  8. exenv: A tool to easily install Elixir versions and manage application environments
  9. CentOS / RHEL : How to assemble a software RAID in Rescue mode
  10. efibootmgr: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • glab Command Examples
  • “glab repo” Command Examples
  • “glab release” Command Examples
  • “glab pipeline” Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright