Skip to main content
Support
0
Contact us
Nederlands
Deutsch
Español
Dedicated serversFlexible VPSCloud TechnologyColocationChallenges in ITSectorsCareers
Cloud Compute

With Cloud Compute, you have access anytime and anywhere to a portal through which you can configure your entire IT environment from wherever you are in the world.

Cloud Storage

Reliable access to your files, infrastructure, and applications at all times – with no interruptions or delays. At Worldstream, we offer a variety of storage solutions.

Flexible cloud icon
Flexible cloud
Private cloud icon
Private cloud
Bare metal icon
Bare Metal Compute
Hollow cube icon
Object storage
Hollow cube icon
File storage
Block storage icon
Block storage
Backup storage icon
Backup storage
Need support?

With experienced engineers and an average response time track record on 7 minutes, you can expect a solid technical support solution in next to no time.

All Servers

Choose your Dedicated Server now. Custom or Instant Delivery. Powerhouse servers built for your use case.

Use Cases

Whatever your use case, we’re here to help you find the ideal solution.

Deal servers icon
Deals
AMD servers icon
AMD Processors
AI servers icon
Intel Processors
Hollow cube icon
Virtualisation, Containerisation and Orchestration
Hollow cube icon
Websites and Applications
Hollow cube icon
Gaming and Streaming Infrastructure

24/7/365 support with an average response time of just 7 minutes. Thanks to our own data centers, our engineers can go directly to your server for fast, hands-on assistance. Email or call us anytime.

Smart outsourcing

Some IT creates added value, while other types are supportive. Use that as a starting point for outsourcing.

Cost Efficiency

Complete IT packages may seem like the safe option, but when you consider the costs, other choices often make more sense.

IT flexibility & control

Outsourcing doesn’t mean losing control; it actually provides more flexibility and control.

Cloud repatriation

The cloud is not a final destination: You should continuously evaluate and adjust your cloud environment as needs evolve.

Financial services
Logistics & Transportation
Retail & E-commerce
Media & Entertainment
Tech & Software Development
Security
Managed Service Providers
Need support?

With experienced engineers and an average response time track record on 7 minutes, you can expect a solid technical support solution in next to no time.

Chat with usContact us
About WorldstreamAbout the technologyCasesKnowledge base
About usMeet the teamJobsBecome a resellerCertificationsOur data centersOur networkDDoS ProtectionAMD EPYC serversTechnology PartnersOperating SystemsAll casesEasyTerraDutch Drone CompanyPerfGridArticlesFAQNews and BlogsProducts and Services
Contact us

Call +31 (0) 174 – 712 117

Industriestraat 53, Naaldwijk

Nederlands
Deutsch
Español
0
Dedicated serversFlexible VPSCloud TechnologyColocationChallenges in ITSectorsCareersAbout WorldstreamAbout the technologyCasesKnowledge baseMy Worldstream
Contact
Support
NederlandsDeutschEspañol
  1. HomeHome
  2. Knowledge Base
  3. Compute
  4. Hardening a fresh VPS: SSH keys, firewall and Fail2ban

Hardening a fresh VPS: SSH keys, firewall and Fail2ban

Applies to Flexible VPS (Linux)Audience Server administratorsLast reviewed September 2026

Quick answer

Do four things before putting a fresh VPS to real use: switch to SSH key authentication and turn off password logins, install and configure Fail2ban, and set up the portal-level firewall in front of it. Each step is covered in full elsewhere in this knowledge base, this article is the checklist that ties them together.

On this page
  • 1. Switch to SSH key authentication
  • 2. Disable password authentication
  • 3. Install and configure Fail2ban
  • 4. Set up the portal-level firewall
  • Checklist summary

A freshly deployed VPS is reachable on the internet the moment it's created, and automated scanners will find it within minutes. None of the steps below are difficult on their own, doing them in order, before you start using the server, is what matters.

1. Switch to SSH key authentication

1

Generate and install a key pair

Generate an SSH key pair on your own machine and copy the public key to the server. See Creating an SSH key pair for the full walkthrough, including ssh-keygen and ssh-copy-id.

For a new Flexible VPS, it's simpler to add the key before the server exists: go to Flexible VPS → Settings in Portal and add your public key there, manually or imported from GitHub or GitLab, then select it during creation so it's already in place on first boot.

2

Test the key before touching passwords

Log in with the key from a new terminal window while your existing session stays open. Don't move on to the next step until this works.

2. Disable password authentication

Once key login is confirmed working, turn off password logins. Do not just append the settings to /etc/ssh/sshd_config. On most current cloud images that file starts with an Include /etc/ssh/sshd_config.d/*.conf line, the image ships a drop-in file there that sets PasswordAuthentication yes, and sshd keeps the first value it reads for a setting. An edit added at the bottom of the main file is silently ignored, and password login stays on while you think you switched it off.

Start by looking at what is already set:

grep -rnE '^[[:space:]]*(Include|PasswordAuthentication|PermitRootLogin)' /etc/ssh/sshd_config /etc/ssh/sshd_config.d/ 2>/dev/null

If there is an Include line and a drop-in already sets these options, either edit that drop-in, or add your own file with a name that sorts before it. Files in /etc/ssh/sshd_config.d/ are read in name order, so 00-hardening.conf is read before a shipped 50-cloud-init.conf and its values win. Create /etc/ssh/sshd_config.d/00-hardening.conf with:

PasswordAuthentication no
PermitRootLogin no

If your image has no Include line and no sshd_config.d directory, put the same two lines in /etc/ssh/sshd_config itself.

Now check the syntax and, more importantly, the values sshd will actually use:

sudo sshd -t
sudo sshd -T | grep -iE 'passwordauthentication|permitrootlogin'

Both lines must come back as no. If either still says yes, another file is winning, so go back to the grep above and deal with it before you restart anything.

Restart the SSH service to apply it:

# Debian / Ubuntu
sudo systemctl restart ssh

# Rocky Linux / RHEL-based
sudo systemctl restart sshd

Keep your existing session open until you've confirmed a fresh login with the key still succeeds. If you get locked out, Portal's console access can get you back in without SSH; see How to improve your SSH security for the reasoning behind this step and further hardening options, such as changing the default SSH port.

3. Install and configure Fail2ban

Fail2ban watches your authentication logs and temporarily blocks IP addresses after repeated failed login attempts. It's a standard second layer, useful even with password authentication already disabled, since it also covers other services you might run.

1

Install it

# Debian / Ubuntu
sudo apt update && sudo apt install fail2ban
Rocky Linux / RHEL-based
sudo dnf install fail2ban

2

Create a local override

Don't edit jail.conf directly, it gets overwritten on updates. Copy it to a local override file instead:

sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local

In jail.local, enable the SSH jail and set reasonable thresholds, for example:

[sshd]
enabled = true
maxretry = 5
bantime = 1h
findtime = 10m
3

Start and enable the service

sudo systemctl enable --now fail2ban
sudo fail2ban-client status sshd

The status command shows current bans and confirms the jail is active.

4. Set up the portal-level firewall

The steps above all run on the VPS itself. The portal firewall sits in front of it as a separate layer, a managed gateway per region, and is worth setting up even once the server-side hardening is done.

Anything your server needs to reach outbound beyond the firewall's default policy has to be added explicitly as a rule under Firewall Rules. Inbound access to the VPS is controlled the same way, through NAT rules rather than exposing the server directly. See Firewall basics in Portal for how to create one, attach your VPS's network, and set up port forwarding.

Checklist summary

  • SSH key pair generated and tested, see Creating an SSH key pair
  • Password authentication and root login disabled in sshd_config
  • Fail2ban installed, configured with a local override, and running
  • Portal-level firewall created for the region and attached to the VPS, see Firewall basics in Portal
  • Operating system and OpenSSH kept up to date on an ongoing basis

Related articles

  • Creating an SSH key pair
  • How to improve your SSH security
  • Firewall basics in Portal
  • Deploying your first Flexible VPS
Was this article helpful?

Solid IT. No Surprises

Sparring partner for IT maturity
Eliminating barriers so you can run
Predictable and transparant costs

Contact

  • Industriestraat 53, Naaldwijk
  • Payment Methods
  • Abuse
  • Developers Resources
  • Network Operations Center
  • About us
  • Meet the team
  • Jobs
  • Become a reseller
  • Certifications
  • Our data centers
  • Our network
  • DDoS Protection
  • AMD EPYC servers
  • Technology Partners
  • Operating Systems
  • Overview
  • FAQ
  • Cases
  • News & Blogs
  • Use Cases
Nederlands
Deutsch
Español
Nederlands
Deutsch
Español
  • Legal
  • Disclosure