How to set/disable banner message (MOTD) for a specific user in CentOS/RHEL?

Do you know? You can turn off the banner in Linux or Unix using a particular file. We will walk through how to configure them.

 

These are the two types of banners you can configure.

  1. Banner message to display before user logs in (configure in the file of your choice eg. /etc/login.warn)
  2. Banner message to display after the user successfully logged in (configure in /etc/motd)

 

Disable MOTD message for a specific user

 

We use issue.net file to display a banner message. Open the following file with VI editor.

# vi /etc/issue.net

 

I am adding the following banner sample message and then save the file. You can add any custom banner message to this file.

###############################################################
# Welcome to ucartz.com #
# All connections are monitored and recorded #
# Disconnect IMMEDIATELY if you are not an authorized user! #
###############################################################

 

Open the master ssh configuration file and enable banners.

# vi /etc/ssh/sshd_config

 

Search for the word “Banner” and uncomment out the line and save the file.

#Banner /some/path

 

It should be like this.

Banner /etc/issue.net (you can use any path you want)

 

Next, restart the SSH daemon to reflect new changes.

# /etc/init.d/sshd restart
Stopping sshd:                                             [  OK  ]
Starting sshd:                                             [  OK  ]

 

Now try to connect to the server. You will see a banner message as set by us.

Display SSH Warning Message to Users After Login

To disable the MOTD or the banner message, only for a specific user in CentOS/RHEL 7.  

 

We are going to use motd file, which is used to display banner massages after login. Now open it with VI editor.

vi /etc/motd

 

Place the following banner sample message and save the file.

###############################################################
# Welcome to ucartz.com #
# All connections are monitored and recorded #
# Disconnect IMMEDIATELY if you are not an authorized user! #
###############################################################

done!

Was this answer helpful? 2 Users Found This Useful (2 Votes)