How to display a banner message before the Linux system logs in using SSH
This article is about how the Linux system displays banner messages before logging in using SSH. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
OpenSSH has a built-in option called Banner. Sends the contents of the specified file to the remote user before authentication is allowed. If the Banner option is set to none, no Banner messages will be displayed when ssh logs in. By default, banners are not displayed and this option is disabled.
System environment
Centos7
How to turn on the banner option
1. Log in to the remote Linux operating system.
2. Edit / etc/ssh/sshd_config configuration file:
[root@localhost ~] # vim / etc/ssh/sshd_config
3. Add the line Banner / etc/ssh/my_banner at the end of the configuration file:
Banner / etc/ssh/my_banner
4. Save the configuration file and exit editing.
5. Create / etc/ssh/my_banner file:
[root@localhost ~] # touch / etc/ssh/my_banner
6. Restart the sshd service:
[root@localhost] # systemctl restart sshd find an ASCII Art pattern you like
You can search ASCII art on the Internet, and there will be many websites that generate ascii art words. You can also convert pictures to ASCII types.
Another way is to use the figlet command to generate an enlarged version of normal characters. In centos, you need to install the Epel source, and then install the figlet program:
[root@localhost ~] # yum-y install figlet [root@localhost ~] # figlet LinuxProbe
You can see the generated text. We can write the artistic fonts generated by figlet into the / etc/ssh/my_banner file:
[root@localhost ~] # figlet LinuxProbe > / etc/ssh/my_banner
Now you can log in to the linux operating system with ssh and take a look:
[root@localhost] # ssh root@localhost Thank you for reading! This is the end of the article on "how to display banner messages before logging in using SSH in Linux system". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!