Urgent.News

What's breaking now, across thousands of outlets.

Tech

Setting Up Your Own VPS: A Secure Starting Point

Every self-hosted project I run starts the same way: a brand new VPS and about twenty minutes of setup before I install a single application. That twenty minutes is what separates "my server" from "someone else's crypto miner." A fresh box with a public IP starts getting probed within minutes, and the default configuration on most images is built for convenience, not safety. This is the secure…

Setting up a Virtual Private Server (VPS) from scratch can provide a secure foundation for various projects. This guide outlines a series of steps to harden a VPS running a current Ubuntu LTS distribution, focusing on best practices to minimize security risks.

First, log in to the VPS using SSH with the credentials provided by your hosting provider. Once logged in, update the system's package list and upgrade all installed packages to ensure a fully patched environment. Creating a non-root user with sudo privileges is crucial to avoid running administrative tasks as the root user, which can lead to security vulnerabilities.

Next, set up an SSH key-based authentication system instead of relying on password authentication. Generate a new SSH key pair on your local machine and securely transfer the public key to the VPS. After verifying that SSH key authentication works, disable password-based logins and configure the SSH server to reject root logins entirely.

Harden the SSH configuration by disabling unnecessary authentication methods, setting a reasonable number of authentication attempts, and restricting X11 forwarding to prevent remote graphical access.

To further enhance security, install and configure a firewall (e.g., UFW) to control inbound and outbound network traffic. By default, block all incoming traffic and only allow essential services such as SSH and web traffic (80 and 443 ports for HTTP and HTTPS). Regularly update the system with unattended security updates to ensure that any newly discovered vulnerabilities are promptly patched.

Optional enhancements may include additional security measures such as setting up a VPN, implementing two-factor authentication, or configuring additional network security tools. However, these steps are beyond the scope of this basic setup guide and should be considered based on the specific needs and risk profile of your project. By following these steps, you establish a robust and secure baseline for your VPS, laying the groundwork for safely deploying applications and services.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Monday 31 August →