# How to Secure Your VPS: Firewall, SSH Keys and Updates

> Canonical: https://jethost.com/kb/how-to-secure-your-vps/ · Last modified: 2026-08-20T06:47:44+00:00

Because a VPS is exposed to the public internet with full root access, securing it is your responsibility as part of the self-managed model. The good news: a handful of steps on day one blocks the vast majority of attacks.

## 1. Update everything first

The very first command on a new server should be a full update - `sudo apt update && sudo apt upgrade` on Ubuntu/Debian. Enable automatic security updates so you stay patched.

## 2. Use SSH keys and disable password login

Set up SSH key authentication, then disable password logins in `/etc/ssh/sshd_config`. This single change stops password brute-force attacks entirely.

## 3. Lock down the firewall

In the VPS **Firewall** tab, allow only the ports you need - typically SSH (22), HTTP (80) and HTTPS (443) - and restrict SSH to your own IP where you can. Close everything else.

## 4. Reduce your attack surface

- Create a non-root user for day-to-day work and use `sudo`
- Install **Fail2ban** to block repeated failed logins
- Uninstall services you don't use
- Take regular **snapshots** so you can roll back if needed

## JetHost Experts Tip

Before tightening SSH rules, confirm the browser **Console** works. It's your safety net: if a firewall or SSH change ever locks you out, the console still gets you back in.

## Need More Help?

A secure VPS starts with updates, SSH keys and a tight firewall - all doable in your first hour. If you get stuck, the JetHost team is available 24/7 and usually answers in under five minutes - just [contact us](https://jethost.com/contact-us/) and we'll help you sort it out. Explore our other [VPS tutorials](https://jethost.com/kb/category/vps/) to get the most out of your server.
