Top 5 Tips to Harden Your Linux VPS Against Attacks in 2025

In 2025, cyberattacks are more sophisticated than ever. Whether you’re hosting a personal project or critical business application, securing your Linux VPS is no longer optional—it’s essential. Thankfully, with just a few steps, you can drastically reduce your risk and keep your VPS locked down against the most common threats.

At Hosteons, we provide high-performance KVM VPS with root access, but security is a shared responsibility. Here’s how you can harden your VPS in minutes:


1. Use SSH Keys Instead of Passwords

Disable password login and use SSH key authentication for more secure, automated, and brute-force-resistant logins.

Steps:

  • Generate a key pair using ssh-keygen
  • Upload your public key to your VPS: ~/.ssh/authorized_keys
  • Disable password auth in /etc/ssh/sshd_config

👉 Read: Why You Should Use SSH Keys Instead of Passwords


2. Set Up a Firewall (UFW/iptables)

Block unnecessary ports to reduce your attack surface. Only open what’s required (e.g., 22 for SSH, 80/443 for web).

Example with UFW:

sudo ufw default deny incoming
sudo ufw allow 22
sudo ufw allow 80
sudo ufw allow 443
sudo ufw enable

3. Install and Configure Fail2Ban

Prevent brute-force attacks by banning IPs with too many failed login attempts.

Install Fail2Ban:

sudo apt install fail2ban

Create a jail for SSH and monitor logs like /var/log/auth.log or /var/log/secure.

👉 Full Fail2Ban Guide


4. Keep the System and Software Updated

Always run the latest security patches. Use tools like unattended-upgrades for automated updates.

Commands:

sudo apt update && sudo apt upgrade
sudo yum update

Outdated software is one of the most exploited vulnerabilities.


5. Monitor Login Attempts and File Changes

Install tools to track unauthorized access and suspicious activity.

  • Use auditd to track system events
  • Use logwatch or logcheck to scan logs for anomalies
  • Monitor /var/log/auth.log for failed logins

👉 Read: How to Monitor Login Attempts and File Changes on Your VPS


Bonus: Disable Root Login

Prevent direct root access by using a non-root sudo user instead.

In /etc/ssh/sshd_config:

PermitRootLogin no

Final Thoughts

Hardened servers are happy servers! With these 5 simple steps, you’ll block the majority of attacks targeting Linux VPS.

At Hosteons, we give you the control, performance, and reliability — now it’s your turn to secure it.

🔐 Ready to deploy a secure VPS?

👉 Explore Our KVM VPS

👉 Premium Ryzen VPS

🚀 Instantly Secure and Set Up Your VPS with Hosteon’s Initial VPS Setup Script

Managing a new VPS can be overwhelming, especially when starting with a fresh Linux installation. That’s why we at Hosteons created a smart, interactive script to help new VPS users quickly set up their server with best practices in place—regardless of whether you’re using Ubuntu, Debian, AlmaLinux, CentOS, or Rocky Linux.


🎯 What This Script Does

Our open-source script, initial_vps_setup.sh, automates essential initial tasks, including:

  • 🔐 Creating a new sudo user
  • 📛 Checking if the user already exists and giving the option to update sudo access
  • 🧰 Installing basic tools (curl, wget, git, htop, unzip, etc.)
  • 🧱 Enabling firewall with UFW or firewalld based on your distro
  • 🔐 Optionally generating a secure SSH key pair (displays private + public key for user)
  • 🚫 Option to disable root SSH login
  • ✅ Sets correct permissions and groups

🛠️ Compatible with All Major Linux Distributions

Tested and supported on:

  • Ubuntu
  • Debian
  • AlmaLinux
  • CentOS
  • Rocky Linux

The script auto-detects your OS and executes distro-specific commands where needed.


📜 Easy to Use

Just log in as root on your new VPS and run:

curl -sL https://raw.githubusercontent.com/hosteons/Initial-VPS-Setup-Script-for-Linux/main/initial_vps_setup.sh | bash

You’ll be guided through a few interactive prompts—no manual file editing required.


💻 Example Output and Access Instructions

After setup, you’ll get:

  • Username and SSH access instructions
  • SSH key (if generated)
  • Sample sudo usage instructions like:
sudo apt update
sudo systemctl restart nginx

🔐 Why It Matters

  • Security First: Disabling root login and using SSH keys makes brute-force attacks significantly harder.
  • Consistency: Every VPS is provisioned the same way—ideal for sysadmins managing multiple servers.
  • Time-Saving: No need to copy-paste multiple commands or look up tutorials.

❤️ Built and Maintained by Hosteons

This script is built and maintained by the team at Hosteons as part of our effort to make VPS hosting smoother and safer for everyone.

💾 GitHub Repo:

👉 https://github.com/hosteons/Initial-VPS-Setup-Script-for-Linux

🔐 Automatically Install Fail2Ban with Smart Jail Detection on Your VPS (Script by Hosteons)

Here’s a complete WordPress blog post draft to promote your Fail2Ban Auto-Installer script from GitHub:


🔐 Automatically Install Fail2Ban with Smart Jail Detection on Your VPS (Script by Hosteons)

At Hosteons, we’re committed to making server security easier for everyone. Whether you’re running a small VPS or managing a fleet of Linux servers, protecting against brute-force attacks is critical.

That’s why we’ve created a Fail2Ban Auto-Installer Script that not only installs Fail2Ban but also auto-detects and enables jails for common services like SSHApache, and Nginx — all in one click.

👉 GitHub Repository:

https://github.com/hosteons/Fail2Ban-Auto-Installer-With-Jail


✅ Key Features

  • Installs Fail2Ban on UbuntuDebianAlmaLinux, and CentOS
  • Detects installed services (e.g., sshd, nginx, apache) and enables jails accordingly
  • Skips jails for services not found on the system
  • Handles log file paths intelligently based on distro
  • Verifies and restarts Fail2Ban only if configuration is valid
  • Smart checks if Fail2Ban is already installed
  • Minimal and safe — logs errors clearly

🧠 How It Works

When you run the script:

  1. It detects your Linux OS flavor.
  2. Installs Fail2Ban (if not already installed).
  3. Checks if apache, nginx, or sshd is active.
  4. Adds only the appropriate jails with correct log paths.
  5. Restarts Fail2Ban and confirms its status.
  6. Provides clear output so you know it’s working.

This ensures Fail2Ban doesn’t fail due to missing log files or services — a common issue in manual configurations.


📥 How to Use

  1. Download the script:
wget https://raw.githubusercontent.com/hosteons/Fail2Ban-Auto-Installer-With-Jail/main/fail2ban_auto_installer.sh
chmod +x fail2ban_auto_installer.sh
./fail2ban_auto_installer.sh
  1. That’s it. The script handles the rest!

🚀 Need a Secure VPS?

This script runs perfectly on our KVM VPS and Ryzen VPS plans. Visit hosteons.com to explore secure hosting powered by NVMe SSD and DDoS protection — with native support for IPv6, WireGuard VPN, and more.


🔗 Related Resources

One-Click Linux Malware & Rootkit Scanner Using ClamAV and RKHunter

Secure Your Linux VPS in One Click with Our Rootkit & Malware Scanner

Running a VPS or dedicated server? One of the most overlooked but critical steps is making sure your system is free of rootkits and malware.

To simplify this task, we at Hosteons have released a free and open-source script that automatically installs, updates, and runs malware and rootkit scans using two of the most trusted tools in the Linux ecosystem:

  • ClamAV – an open-source antivirus engine
  • RKHunter – a rootkit scanner that checks for backdoors, local exploits, and suspicious files

🔧 What the Script Does

  • Detects your Linux distribution (Ubuntu, Debian, CentOS, AlmaLinux)
  • Installs ClamAV and RKHunter
  • Automatically updates malware and rootkit signature databases
  • Fixes common errors like WEB_CMD=”/bin/false” in RKHunter config
  • Runs full ClamAV scan
  • Executes a complete RKHunter rootkit check
  • Compatible with minimal or fresh VPS installations

📥 Download and Run

Run the following commands to download and execute:

curl -O https://raw.githubusercontent.com/hosteons/linux-malware-scanner/main/scan.sh
chmod +x scan.sh
sudo ./scan.sh

Or get the full packaged ZIP with README and LICENSE:

👉 Download from GitHub


📋 Output and Logs

  • ClamAV scan will output infected files (if any)
  • RKHunter will show warnings and potential issues
  • All actions run with user confirmation and are fully transparent

⚠️ Note

This script is non-destructive – it only scans and reports. It does not automatically delete or quarantine any files. Always review flagged files before taking any action.


🎯 Why Use This?

  • Ideal for hosting providers and system admins
  • Perfect for VPS users looking for a quick, effective scan
  • Good first step after initial OS setup

🙌 Contribute or Report Issues

You can fork, improve, or report bugs directly on GitHub:

🔗 https://github.com/hosteons/linux-malware-scanner

🔐 Easily Change Your Windows RDP Port with a One-Click Script

One-Click Windows RDP Port Changer Script 🖥️

Managing a Windows VPS often requires securing RDP (Remote Desktop Protocol) access. One of the most effective and simplest ways to harden your Windows Server is to change the default RDP port (3389). But doing it manually via the registry and firewall can be tedious and risky.

That’s why we at Hosteons created an open-source, one-click PowerShell script that simplifies the process.

👉 GitHub RepoWindows RDP Port Changer Script


✅ Features

  • Changes RDP Port via Windows Registry
  • Updates Windows Firewall to allow the new port
  • Enables RDP if it’s currently disabled
  • Fully open-source and free under the MIT License
  • Supports Windows Server 2012/2016/2019/2022

📦 How to Use

  1. Login to your Windows VPS as Administrator.
  2. Open PowerShell.
  3. Run the script directly:
iwr -useb https://raw.githubusercontent.com/hosteons/Windows-RDP-Port-Changer-Script/main/rdp_port_changer.ps1 | iex
  1. Enter your desired RDP port when prompted.

⚠️ Important: Make sure your port is not blocked by external firewalls (such as cloud provider rules). Also, ensure you have console/VNC access in case the new port is misconfigured.


🤖 Automation Friendly

This script can be integrated into automation flows for server provisioning or batch management. Perfect for sysadmins managing multiple Windows VPS instances.


🔐 Why Change Your RDP Port?

  • Reduces brute-force attacks from bots scanning port 3389
  • Hides your RDP service from default port scanners
  • Adds an extra layer of obscurity in your defense

👨‍💻 Contribute or Report Issues

This is an open-source script. Feel free to fork, improve, or report issues on GitHub:

👉 https://github.com/hosteons/Windows-RDP-Port-Changer-Script


📣 About Hosteons

Hosteons is a VPS and dedicated server provider offering services in multiple global locations. We’re committed to open-source and providing useful automation tools for system administrators and developers.

🔐 Secure Your VPS Like a Pro: 6 Simple Firewall Rules That Block 90% of Attacks

Running a VPS gives you full control — but it also comes with responsibility. Whether you’re hosting with a budget VPS or a high-performance Ryzen VDS from Hosteons, security should always be a top priority.

Automated bots and malicious actors are constantly scanning servers looking for open doors. The good news? With just a few simple firewall rules, you can block 90% or more of common attacks — no advanced security knowledge needed.


🚧 Step 1: Deny All by Default

Your firewall should start from a “zero trust” position. Block all incoming traffic unless explicitly allowed.

iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT

This is the safest starting point for VPS security.


✅ Step 2: Open Only the Ports You Need

For most users, these are the essential services:

iptables -A INPUT -p tcp --dport 22 -j ACCEPT   # SSH
iptables -A INPUT -p tcp --dport 80 -j ACCEPT   # HTTP
iptables -A INPUT -p tcp --dport 443 -j ACCEPT  # HTTPS

If you’re using a custom SSH port, be sure to update that here.


🛡️ Step 3: Rate-Limit SSH to Stop Brute-Force Attacks

SSH is the most frequently targeted service. Add a rate-limiting rule to block repeated login attempts:

iptables -A INPUT -p tcp --dport 22 -m state --state NEW -m recent --set
iptables -A INPUT -p tcp --dport 22 -m state --state NEW -m recent --update --seconds 60 --hitcount 3 -j DROP

This prevents bots from guessing passwords through brute force.


🧼 Step 4: Drop Invalid or Malicious Packets

Invalid packets are often used in scanning or attack attempts. Drop them:

iptables -A INPUT -m state --state INVALID -j DROP

This helps prevent certain types of kernel-level exploits and misbehavior.


🔁 Step 5: Allow Loopback and Established Connections

Let your server communicate with itself and continue existing sessions:

iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

Without these, things like internal services and return traffic might break.


👀 Step 6: (Optional) Block Ping (ICMP)

Ping isn’t harmful by itself, but attackers use it to detect live servers. You can hide yours:

iptables -A INPUT -p icmp --icmp-type echo-request -j DROP

Note: avoid this if you use ping-based monitoring tools.


💡 Bonus: Use CSF for Easier Firewall Management

Not comfortable with command-line tools? Hosteons VPS plans fully support CSF (ConfigServer Security & Firewall)— a beginner-friendly, feature-rich firewall system with:

  • Easy interface via DirectAdmin
  • Built-in brute-force detection
  • Country-level blocking
  • Port scan detection
  • Daily logs and alerts

Perfect for users who want simplicity without sacrificing power.


🔄 Don’t Forget to Save Your Rules

After setting your rules, make sure they persist after a reboot.

On Ubuntu/Debian:

iptables-save > /etc/iptables/rules.v4

On CentOS/RHEL:

Use iptables-save along with persistent packages, or configure firewalld.


🔐 VPS Security Starts with You

Whether you’re running a personal blog, game server, or production site on a VPS from Hosteons, implementing basic firewall rules should be your first line of defense.

These 6 rules are easy to set up and highly effective. For extra protection, consider:

  • Enabling fail2ban
  • Using SSH keys instead of passwords
  • Running regular security updates

At Hosteons, we offer high-performance, SSD-powered KVM VPS and Ryzen VDS backed by robust network security and full root access — so you’re always in control.

🔒 Ready to launch your secure VPS?

👉 Explore our VPS plans now

🔐 Why We Switched to Plausible Analytics and hCaptcha

A Faster, More Private Web Experience — Without Compromise

At HostEONS, we’re constantly working to make our website and services faster, more secure, and more privacy-respecting — for both our clients and visitors. That’s why we’ve recently made two major changes:

  • ✅ Switched from Google Analytics to Self-Hosted Plausible Analytics
  • ✅ Replaced Google reCAPTCHA with hCaptcha

Here’s why we made the switch — and what it means for you.


📊 From Google Analytics to Self-Hosted Plausible

❌ Why We Left Google Analytics Behind:

  • Heavy scripts that slow down page load times
  • Tracking cookies and IP logging
  • Not privacy-friendly for users (or compliant with global privacy trends)
  • Blocked by ad blockers and privacy tools
  • Sends data to Google — something many privacy-conscious users dislike

✅ Why We Chose Self-Hosted Plausible:

  • Lightweight & fast — the tracking script is ~1 KB
  • No cookies or personal data collected
  • We host it ourselves — full control, no external data transfer
  • Fully open-source and transparent
  • Minimal, useful stats (no bloated dashboards or invasive insights)

💡 By self-hosting Plausible, we maintain complete control over analytics data, while ensuring you’re not tracked or fingerprinted when visiting our site.


🤖 From reCAPTCHA to hCaptcha

❌ Why We Moved Away from Google reCAPTCHA:

  • Slower to load
  • Annoying CAPTCHA challenges (find the traffic light, anyone?)
  • Tracks users via cookies and behavior analysis
  • Relies on Google’s infrastructure and ecosystem
  • Sometimes blocked in certain regions (e.g., China)

✅ Why hCaptcha Is Better:

  • Privacy-focused bot protection
  • Does not track users or store data unnecessarily
  • More region-friendly — works in places where Google is restricted
  • Drop-in compatible with reCAPTCHA — so the transition was seamless
  • Earns micro-rewards for solving CAPTCHAs (helpful for open web projects)

🚀 hCaptcha allows us to stop bots and abuse without tracking our visitors or relying on big-tech gatekeepers.


🧭 Reflecting Our Core Values

These changes aren’t just technical decisions. They align with what we stand for:

  • Speed and efficiency
  • Privacy by default
  • Self-reliance and open standards
  • Respect for user trust

Whether you’re visiting our homepage, reading the blog, or logging into the client area, you’ll now enjoy a cleaner, faster, more ethical experience.


✅ Summary

Tool ReplacedNew ToolWhy It’s Better
Google AnalyticsSelf-hosted PlausibleLightweight, privacy-first, self-owned
Google reCAPTCHAhCaptchaFaster, cookie-free, works globally

We believe hosting providers should care about more than just servers. Every element of our infrastructure — even the frontend — should reflect the same values of transparency, reliability, and respect for our users.

Thank you for choosing HostEONS.

🔗 Explore Hosting Plans

📩 Contact Support