Add a Logon Warning Notification to Linux

  1. Log into the Linux device
  2. Run the following command in a terminal
    # create the logon notification text
    sudo nano /etc/logon-warning.txt
  3. 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. *
    *                                                                     *
    ***********************************************************************
    
    
    
    

  4. Press CTRL+O, Enter, CTRL+X to write the changes
  5. Continue with the following command in terminal
    # edit ssh config file
    sudo nano /etc/ssh/sshd_config
  6. Press CTRL+W and search for Banner
  7. Uncomment the Banner line by removing the #
  8. Enter the path to the logon-warning.txt file as the value

    Banner /etc/logon-warning.txt

  9. Press CTRL+O, Enter, CTRL+X to write the changes
  10. Continue with the following command in terminal
    # restart the ssh server
    sudo systemctl restart ssh*
  11. That's it, try connecting to a new session and the logon warning message should be displayed