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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • 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. autoreconf: command not found
  2. How to Transfer files securely using SCP Command in Linux
  3. nixos-container : Command Examples in Linux
  4. Installing CentOS / RHEL 7 (step by step with screen shots)
  5. zip Command Examples in Linux
  6. gnome-calculator: command not found
  7. halt Command Examples in Linux
  8. Linux “shutdown”, “poweroff”, “halt”, “reboot” Commands
  9. What is SUID, SGID and Sticky bit ?
  10. du Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • protonvpn-cli Command Examples in Linux
  • protonvpn-cli connect Command Examples
  • procs Command Examples in Linux
  • prlimit: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright