Secure your SSH login against brute-force attacks using keys and monitoring tools.

  1. Edit config: nano /etc/ssh/sshd_config, then set PermitRootLogin no, PasswordAuthentication no, PubkeyAuthentication yes.
  2. Create non-root user: adduser secureuser and usermod -aG sudo secureuser.
  3. Copy SSH key: From local, ssh-copy-id secureuser@your-server-ip.
  4. Install Fail2Ban: apt install fail2ban and configure jail for SSH.
  5. Restart: systemctl restart ssh.
  6. Test login with new user and key before closing your current session.

Was this guide helpful?

Thanks for your feedback!