- Log into the Linux device
- Run the following command in a terminal
# create the logon notification text
sudo nano /etc/logon-warning.txt - Enter the text to be displayed during logon, below is an example
******************************* WARNING ******************************* * * * This system is intended for use by authorized users only. * * Unauthorized or improper use of this system is strictly prohibited. * * * ***********************************************************************
- Press CTRL+O, Enter, CTRL+X to write the changes
- Continue with the following command in terminal
# edit ssh config file
sudo nano /etc/ssh/sshd_config - Press CTRL+W and search for Banner
- Uncomment the Banner line by removing the #
- Enter the path to the logon-warning.txt file as the value
Banner /etc/logon-warning.txt
- Press CTRL+O, Enter, CTRL+X to write the changes
- Continue with the following command in terminal
# restart the ssh server
sudo systemctl restart ssh* - That's it, try connecting to a new session and the logon warning message should be displayed