Offer

Pay yearly and get 2 months free + an extra 30% off your hosting

Claim offer
HostingWeb HostingLiteSpeed and NVMe on FlyPanelfrom ৳100BDIX HostingPeered inside Bangladeshfrom ৳100WordPress HostingTuned for WooCommercefrom ৳1,000
Built in-houseFlyPanel, malware protection, backupsCustom-tailored, included on every plan→
2 months free on yearlyCompare products
ServersVPS HostingKVM with full root accessfrom $20BDIX VPSPeered inside Bangladeshfrom $20Dedicated ServersAMD Ryzen and dual Xeonfrom $250
1 Gbps port, Tier-3 datacentersCustom build
ResourcesKnowledgebaseSetup guides and troubleshootingBlogProduct news and performance tipsAbout Doze HostWho we are and where servers liveNetwork statusLive uptime for every service↗
Register a domainSearch and register a new nameClient areaBilling, services and invoices↗
Talk to an engineer, 24/701795 470074
Talk to us, 24/7Call an engineerReal people, day and night01795 470074Email supportsupport@dozehost.com↗Open a ticket27 min average first response↗
Help yourselfKnowledgebaseSetup guides and troubleshootingBlogProduct news and performance tipsNetwork statusLive uptime for every serviceLive
Client area: billing, services, invoicesLog in
Hosting Web Hosting ৳100/moLiteSpeed, FlyPanel, daily backups BDIX Hosting ৳100/moPeered inside Bangladesh WordPress Hosting ৳1,000/moTuned for WooCommerce
Servers VPS Hosting $20/moKVM with full root BDIX VPS $20/moPeered inside Bangladesh Dedicated Servers $250/moAMD Ryzen and dual Xeon
Domains
Resources Knowledgebase Blog About Doze Host Network status
Help Call 01795 470074Real engineers, 24/7 Email supportsupport@dozehost.com Open a ticket27 min average first response Knowledgebase Blog
Get started Log in
Home / Knowledgebase / VPS ManagementVPS Management

How to Secure Your VPS Firewall, SSH Hardening and Fail2Ban

Last updated July 21, 2026About 2 minutes to read

An unmanaged VPS gives you full root control — which also means you’re responsible for securing it. These steps cover the essentials that stop the vast majority of automated attacks.

1. Change the default SSH port

Most automated attacks scan port 22 by default. Editing /etc/ssh/sshd_config to use a non-standard port (then restarting the SSH service) filters out a large share of untargeted scanning immediately. This isn’t a substitute for real security, but it does cut down noise in your logs significantly.

2. Disable root password login

In the same config file, set PermitRootLogin prohibit-password (or no if you use a separate sudo user) and PasswordAuthentication no once you’ve set up SSH key authentication. This makes brute-force password attacks against root impossible regardless of password strength.

3. Set up SSH key authentication

Generate a key pair on your local machine (ssh-keygen), then copy the public key to the server with ssh-copy-id user@your-server-ip. Confirm you can log in with the key before disabling password auth, so you don’t lock yourself out.

4. Configure a firewall

Use CSF (ConfigServer Firewall, included with CyberPanel and commonly installed on cPanel servers) or plain ufw/firewalld to allow only the ports you actually need — typically your custom SSH port, 80/443 for web, and your control panel’s port. Deny everything else by default.

5. Install Fail2Ban

Fail2Ban watches log files for repeated failed login attempts and temporarily (or permanently) bans the offending IP at the firewall level. Enable jails for SSH at minimum, and for your web server/control panel login if a jail is available for it.

6. Keep everything updated

Run OS security updates regularly (or enable unattended-upgrades on Ubuntu/Debian for security patches specifically), and keep your control panel, PHP version, and any installed applications current — most VPS compromises exploit known, already-patched vulnerabilities rather than anything novel.

Still stuck?Our support team is here 24/7. A real person replies to every request.