How to Secure Your Linux Server Using Hosteon's One-Click Hardening Script Print

  • ubuntu, centos, bash script, vps, debian, almalinux, ssh security, hosteons, fail2ban, selinux, open source tools, linux hardening, lynis
  • 0

To help you harden your Linux server quickly and securely, Hosteons has released a free, open-source hardening script that works across:

 

  • Ubuntu

  • Debian

  • CentOS

  • AlmaLinux

 

This script automates essential security steps such as updating your system, configuring SSH access, setting up a firewall, and running a basic audit.

 


Features

  • Automatically updates system packages

  • Prompts to change SSH port

  • Optionally disables root login

  • Option to create a new sudo-enabled user

  • Installs and enables Fail2Ban

  • Installs and runs a Lynis audit

  • Enables UFW (for Ubuntu/Debian) or firewalld (for CentOS/AlmaLinux)

  • Adjusts SELinux policies if active

 

 


 

 

How to Use

 

  1. SSH into your VPS as root

  2. Run the following commands:

 

curl -O https://raw.githubusercontent.com/hosteons/Linux-Hardening-Script/main/harden.sh
chmod +x harden.sh
./harden.sh

 

  1. Follow the interactive prompts to configure your server securely

 


 

Important Notes

 

 

  • You must have console access (such as VNC or IPMI) in case SSH access is misconfigured

  • Use with caution on production servers

  • The script supports common distributions only (Ubuntu, Debian, CentOS, AlmaLinux)

 


 

GitHub Repository

 

You can view or contribute to the project at:

https://github.com/hosteons/Linux-Hardening-Script


Was this answer helpful?

« Back