The independent file on technology, travel & lifeFrom Pakistan, for everywhere
Huzi Blogs.
The ArchiveSectionsSearch

Planning a trip? HTG Travels — flights, visas, hotels & Umrah, handled properly.

WhatsApp +92 317 5054959
Huzi Blogs.

An independent file on technology, travel and life — long-form guides written plainly, from Pakistan, for everywhere.

ShopMeet the Creator

Sections

  • Travel
  • Technology
  • Lifestyle
  • Programming
  • Sports
  • Linux
  • All sections

The Desk

  • The Archive
  • Search the file
  • Disclaimer & Data Privacy Policy
  • A project of huzi.pk

© 2026 blogs.huzi.pk — All rights reserved.

Set in Playfair Display & Inter

    HomeCybersecurityStory
    Cybersecurity

    Linux Security Hardening 2026: The Complete Problem-Solving Guide

    H

    By Huzi

    File #541 · 3 min read

    Spin up a fresh Ubuntu VPS and the bots arrive within minutes, knocking on port 22 with root and terrible passwords. Nearly all of it is automated opportunism, and it is defeated by one disciplined afternoon of hardening applied in the right order. Here is the checklist, lockout risks included.

    The quick answer: Keys first, passwords never; allow your firewall ports before reload; then let fail2ban and auditd keep watch. That order is the whole difference between a hardened box and a locked-out one.

    Layer Tool What it stops
    Login Ed25519 key + sshd_config Password-guessing bots on port 22
    Perimeter firewalld Traffic to ports nothing serves
    Offenders fail2ban Repeat guessers jailed — maxretry 3, bantime 3600
    Evidence auditd Silent changes to sensitive files
    Patching unattended-upgrades Security fixes sitting unapplied overnight

    SSH before anything else

    Keys first, passwords never. Generate an Ed25519 pair on your laptop — never on the server — copy it across while password login still works, and test it in a second terminal before touching a single setting.

    ssh-keygen -t ed25519 -C "deploy@my-laptop"
    ssh-copy-id deploy@your-server-ip
    

    Then tighten /etc/ssh/sshd_config:

    PermitRootLogin no
    PasswordAuthentication no
    MaxAuthTries 3
    AllowUsers deploy
    

    Restart the daemon and keep your old session open until the new one proves itself. Disabling passwords before the key is confirmed is the classic way people lock themselves out of their own VPS.

    The wall: firewalld

    Ubuntu folk often reach for UFW; on Fedora, RHEL and CentOS Stream the tool is firewalld. The principle is identical either way — deny by default, open only what genuinely serves traffic.

    sudo firewall-cmd --permanent --add-service=ssh
    sudo firewall-cmd --permanent --add-service=https
    sudo firewall-cmd --reload
    sudo firewall-cmd --list-all
    

    Allow your working ports before you reload. The order is the whole trick.

    Least privilege travels better than any packing cube: scatter only the copies a vendor needs and keep the originals on you. When the document side of a trip starts feeling like open ports, HTG Travels is the desk that closes them — visas, tickets, one custody chain.

    fail2ban for the bots that remain

    The firewall gates ports; fail2ban reads logs and jails the IPs that keep guessing. Put overrides in jail.local so package upgrades never clobber them:

    [sshd]
    enabled = true
    maxretry = 3
    bantime = 3600
    ignoreip = 127.0.0.1/8 YOUR_HOME_IP
    

    Pro tip: Add your own address to ignoreip before restarting — one bad evening of typos should not ban you from your own machine.

    auditd: know when things change

    A hardened box should also tell you when something changes on it. auditd watches sensitive files and writes a searchable trail:

    sudo auditctl -w /etc/passwd -p wa -k identity
    sudo auditctl -w /etc/ssh/sshd_config -p wa -k sshd_change
    sudo aureport -k | tail -20
    

    On Debian-family systems, add unattended-upgrades so security patches land overnight without you — and read /var/log/unattended-upgrades/ weekly, because a silent failed update is worse than none at all.

    Apply the sequence — key tested, sshd tightened, firewall live, fail2ban watching, auditd recording — and the automated waves that sink careless servers simply bounce off yours.

    Watching volunteers in Gaza rebuild their networks from salvaged machines and solar panels, the old free-software line about code being as free as its people stops sounding like a slogan and starts sounding like survival.

    Redundancy is the quiet lesson of this whole post, and travel deserves it too. When an airline cancels at midnight, we at HTG Travels rebook our passengers before the counter queue forms — keep our number saved next to your backups. Plan first, pay later — reach the desk on +92 317 5054959 for conferences abroad, visas included.

    Presented by

    HTG Travels — Plan the Trip, Skip the Runaround

    Flights, visas, Umrah packages and Hunza–Skardu tours, handled end to end from our licensed Sialkot desk. Real fares, hotel names in writing, and a human who answers — before you pay a rupee.

    Flights & rebooking Visa files Umrah 2026–27 Northern tours
    Visit htg.com.pkWhatsApp +92 317 5054959

    Sialkot, Pakistan · Licensed agency · Fast quotes on WhatsApp


    You Might Also Like

    Premium Mirror & Heavy Handwork Net Bridal Maxi | Silk Border Dupatta

    Premium Mirror & Heavy Handwork Net Bridal Maxi | Silk Border Dupatta

    PKR 11000

    Ivory Organza Wedding Dress – Heavy Handwork, Aqua Net Dupatta

    Ivory Organza Wedding Dress – Heavy Handwork, Aqua Net Dupatta

    PKR 8000

    Luxurious Handwork Heavy Embroidered Organza Bridal Suit 2025 | Dyed Satin Silk Trouser

    Luxurious Handwork Heavy Embroidered Organza Bridal Suit 2025 | Dyed Satin Silk Trouser

    PKR 9600

    Luxurious Heavy Embroidered Velvet Suit 2026 | Emb. Silk Trouser & Chiffon Dupatta

    Luxurious Heavy Embroidered Velvet Suit 2026 | Emb. Silk Trouser & Chiffon Dupatta

    PKR 9600

    Luxury Heavy Embroidered Velvet Dress 2026 | Emb. Chiffon Dupatta

    Luxury Heavy Embroidered Velvet Dress 2026 | Emb. Chiffon Dupatta

    PKR 9200

    Keep reading

    Related files

    Cybersecurity

    Web Security Fundamentals 2026: The Complete Problem-Solving Guide

    The 2026 defense-in-depth stack, from a working Next.js headers block to nonce-based CSP, HSTS preload, post-quantum X25519MLKEM768, and the quiet COOP/COEP/CORP trio.

    By HuziFile #551

    Read
    Cybersecurity

    The Ultimate WordPress Security Guide 2026: Fortify Your Site Like a Cybersecurity Expert

    A WordPress-specific hardening walkthrough for 2026: wp-config keys, locking down wp-admin, plugin hygiene, killing xmlrpc.php, and backups you have actually tested.

    By HuziFile #422

    Read
    Cybersecurity

    WhatsApp Business for Pakistani SMBs in 2026: The Complete Sales Playbook

    Catalogs that sell across time zones, away messages that cover the gap while you sleep, the 256-broadcast ceiling, template rules, and the settings that keep a business number from being hijacked.

    By HuziFile #489

    Read
    Cybersecurity

    Cryptography 101: A Beginner's Guide to Digital Security in 2026

    Encryption, hashing, key exchange and the post-quantum NIST standards explained without the maths degree — plus why passkeys change everything for normal users.

    By HuziFile #108

    Read
    Cybersecurity

    The Pocket Pentester: Running Kali Linux on Mobile (2025 Ultimate Guide)

    Run Kali Linux on an Android phone for real: the Termux NetHunter install command by command, plus UserLAnd and Andronix alternatives and what a non-rooted phone can honestly do.

    By HuziFile #259

    Read
    Cybersecurity

    The Ghost in the Browser: A Guide to XSS Prevention in 2026

    Stored, reflected and DOM-based XSS explained, plus the defences that hold in 2026: context-aware escaping, DOMPurify, a strict CSP with Trusted Types, and hardened cookies.

    By HuziFile #107

    Read
    Back to the archive