How to Set Message (MOTD) Banner
Let's edit the SSH banner file. The /"etc/motd" file is usually used. You can open the file using the following command:
sudo nano /etc/motd
In the text editor, create or edit your SSH message banner.
_ _ ___ _ __
( )_ ( ) ( _`\ (_ ) /' _`\
| ,_)| |__ __ | ( (_) _ _ | | __ _ __ | ( ) |
| | | _ `\ /'__`\ | |___ ( ) ( ) | | /'__`\( '__)| | | |(`\/')
| |_ | | | |( ___/ | (_, )| (_) | | | ( ___/| | | (_) | > <
`\__)(_) (_)`\____) (____/'`\___/'(___)`\____)(_) `\___/'(_/\_)
>>farukguler.com
After saving the changes, restart the SSH service for them to take effect. You can use the following commands:
sudo systemctl restart ssh
sudo systemctl restart sshd
sudo systemctl status ssh
sudo systemctl status sshd
#Now SSH message banner is set on your server. When you next SSH session opens, your banner will be displayed to all your users.
Also, to apply Banner to Server Console and SSH interface with #Banner /etc/issue.net file:
You need to set the "banner path" in the SSH configuration file (sshd_config).
sudo nano /etc/ssh/sshd_config
In the editor, look for the "Banner" parameter. If it is a comment line (starts with "#"), edit it as follows, removing the "#".
# Banner /etc/issue.net
Below you will find sections where you can edit the two areas where you want to apply a banner.
#sudo nano /etc/issue.net (SSH Client)
\S
Kernel \r on an \m
sudo nano /etc/issue (Server Consolu)
\S
Kernel \r on an \m
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+
farukguler.com
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+
Host Name: \n
Time: \d \t
System IP address: \4
User Name: faruk
Password: Passwd12345
Ubuntu 22.04.2 LTS \n \l
____ ______ _
/ __/__ _____ _____ ____ / ___(_)___(_)__
_\ \/ -_) __/ |/ / -_) __/ / (_ / / __/ (_-<
/___/\__/_/ |___/\__/_/ \___/_/_/ /_/___/
>>>Server Giris
>>https://www.ascii-art-generator.org
>>https://www.coolgenerator.com/ascii-text-generator
After saving the changes, restart the SSH service for them to take effect. You can use the following commands:
sudo systemctl restart ssh sudo systemctl restart sshd sudo systemctl status ssh sudo systemctl status sshd
#You are ready
ssh user@server-ip
ssh [email protected]
Umarım faydalı olmuştur. – I hope it was useful.