My How Tos
  1. You are here:  
  2. Home
  3. Categories
  4. Servers
  5. OpenSSH
  • OpenSSH

SSH Banner Creation

How to create and implement a banner for ssh connections. This is not going to alter MOTD etc., its only the banner or warning screen users see upon connection to the server.

 

1- nano /etc/ssh/banner.local

Remove the current content and replace with your own personal message. This is an example I grabbed from a ChatGPT convo

 


WARNING: Unauthorized access to this system is prohibited! All activities are logged and monitored.




2- Edit sshd_config 

  • nano /etc/ssh/sshd_config
  • remove the # from the Banner line and change the reference to /etc/ssh/banner.local
  • save and close the file
  • restart sshd service

 

To test log out of your current ssh session and login again.

Edit sshd config to Lock Down SSH Access

This is to edit the configuration file for the ssh server hosted on most vps solutions and used for general server management. 

On Ubuntu you will need to edit two files. Do not restart ssh services until every step is completed.

 

1- Edit the ssh config file

  • nano /etc/ssh/sshd_config
    • alter the following lines to your desired configurations or alter them to the ones below. You may also need to remove the # symbol for the configuration to take affect.
      • Port 1022
      • AllowRootLogin no
      • remove # from line for AuthorizedKeysFile
      • PasswordAuthentication no
      • PermitEmptyPasswords no
    • save and close the file (ctrl +x, press y then enter)
  • nano /etc/ssh/sshd_config.d/50-cloud-init.conf
    • edit the PasswordAuthentication from yes to no
      • save and close the file (ctrl +x, press y then enter)

 

2- Update the firewall rules

  • See directions in Article UFW For Ubuntu for directions to match your port number change in the configuration above and allow it via ufw.

 

3- Restart the SSH Service or Reboot the Server (Dealers Choice)

  • to restart the service run
    • service sshd restart
  • or to reboot run
    • sudo reboot -n

 

 

Main Menu

  • Home
    • All
  • Categories
  • Out Of Date Topics

Login Form

  • Forgot your password?
  • Forgot your username?