Display SSH warning message before & after logon

Log on to your server as su and create the message text you want to show

vi /etc/ssh/warning.txt

Now, create your message by pressing “i” to enter text insert mode, press “esc” when you are done.

#######################################
#                                     #
#     Warning - Private SSH Server    #
#       Please leave immediately      #
#                                     #
#######################################

Press :w to save and :q to quit vi

Edit the main ssh config file and let it know that you are using a banner

# vi /etc/ssh/sshd_config

Search for the word banner and change the line from

#Banner /some/path

to

Banner /etc/ssh/warning.txt

Now restart ssh

# /etc/init.d/sshd restart

Login to your server and see the new message

You can do exactly the same to display a message after the user logs in by editing the file /etc/motd

vi /etc/motd

This file is read by CentOS every time a user starts a shell session so no restart or ssh config is required.

Print Friendly, PDF & Email

More Like This


Categories


CentOS Linux Security Web Hosting
  • Post a comment