Linux VPS Security Hardening Checklist: SSH, Firewall, Updates, Backups, and Audit Workflow
VPSLinuxserver securityUbuntuDebianSSHDevOps

Linux VPS Security Hardening Checklist: SSH, Firewall, Updates, Backups, and Audit Workflow

OOpenWebHosting Editorial Team
2026-11-21
8 min read

A practical Linux VPS security hardening checklist covering SSH, firewalls, updates, secrets, backups, monitoring, and recurring audits.

A new Linux VPS is not ready for production simply because it has an operating system and a public IP address. This Linux VPS security hardening checklist provides a repeatable, provider-neutral process for securing SSH, limiting exposed services, applying updates, protecting secrets, configuring backups, and verifying that the server still works after changes. Use it before hosting a website, CMS, API, Docker workload, or other self-hosted application, then return to it monthly or quarterly and after significant infrastructure changes.

Overview

VPS hardening is the process of reducing unnecessary access and improving your ability to detect, contain, and recover from problems. It does not make a server invulnerable, and it should not be treated as a one-time task. Security depends on the operating system, application code, dependencies, credentials, provider account, DNS, monitoring, and recovery process.

Start with a written inventory of the server’s purpose, operating system release, public IP addresses, private network interfaces, domains, applications, listening ports, administrator accounts, and backup destinations. Record the initial state before changing configuration. This makes future audits and troubleshooting easier.

Before editing SSH or firewall settings, confirm that your hosting provider offers a web console, serial console, rescue mode, or another out-of-band access method. Keep one existing administrative session open while testing changes, and do not close it until a separate session has successfully connected with the new settings.

The goal is a small, understandable baseline:

  • Only named administrators can log in, preferably with SSH keys.
  • Routine administration uses a non-root account with narrowly controlled sudo access.
  • Only required network services are reachable from the internet.
  • Security updates are applied promptly and tested according to the workload.
  • Logs, backups, and alerts support investigation and recovery.
  • Configuration changes are documented and reversible.

What to track

SSH access and administrator accounts

Create an individual administrator account for each person who needs access. Give that account sudo privileges rather than sharing root credentials. Individual accounts make access reviews and offboarding practical.

Use SSH keys where possible, protect private keys with a passphrase, and store recovery credentials in an approved password manager. After testing key-based access, review the SSH daemon configuration in /etc/ssh/sshd_config or the distribution’s supported configuration directory. Common settings to evaluate include disabling direct root login, disabling password authentication when your team has working key access, and limiting login to approved users or groups. The exact option names and defaults can vary by OpenSSH and distribution version, so validate the configuration with:

sudo sshd -t

Apply a change using the service manager appropriate to the system, then test a new connection before ending the current session. Avoid copying a hardening snippet without checking whether it conflicts with provider access, automation, cloud-init, deployment tools, or emergency procedures.

Firewall rules and exposed services

List listening services before deciding what to allow. Useful inspection commands include:

sudo ss -tulpn
sudo systemctl --type=service --state=running

Most web servers need TCP 80 and 443. SSH commonly uses TCP 22 unless you have deliberately changed it. Database, cache, container-management, and internal application ports should generally remain private unless there is a specific, documented reason to expose them.

On Ubuntu and Debian systems, common firewall choices include UFW, nftables, and iptables. UFW is often easier for a straightforward single VPS; nftables provides a more direct, flexible ruleset; iptables may still appear in existing systems or application documentation. Choose one primary firewall management method rather than stacking tools that may overwrite each other.

Tool or areaTypical useCheckpoint
UFWSimple host firewall policyConfirm SSH is allowed before enabling or reloading it.
nftablesNative packet-filtering rules and advanced policiesSave, review, and test the ruleset after reboot.
iptablesLegacy or application-specific firewall workflowsCheck whether another service manages the rules.
fail2banTemporary bans based on log patternsVerify the jail matches current log paths and does not block legitimate administrators.
Unattended update toolingAutomated package update workflowsReview what is updated automatically and how reboots are handled.

Document every allowed port, its owner, and whether it should be accessible from all networks, a trusted IP range, or only a private interface. Recheck the provider’s network firewall or security-group rules as well as the VPS firewall; both layers must permit required traffic, and either layer can expose more than intended.

Updates, services, and application boundaries

Apply available package updates after confirming that you have a current recovery path. On Debian-based systems, a typical workflow is:

sudo apt update
sudo apt upgrade

Use the package manager’s documented process for larger distribution upgrades rather than treating them as routine updates. Track reboot requirements, kernel changes, language runtimes, web servers, database engines, container images, and application dependencies separately. A fully patched operating system does not guarantee that the application or container image is current.

Disable services you do not need, but first identify dependencies. Removing or stopping a service without understanding its role can cause an outage. For internet-facing applications, run the application as a dedicated unprivileged user where practical. Keep databases and administration panels off the public interface unless access controls and the operational need justify exposure.

Secrets, permissions, and logs

Do not place API keys, database passwords, private keys, or provider tokens in public repositories, shell history, tickets, or world-readable files. Prefer a managed secret store, protected environment configuration, or a carefully permissioned file outside the application’s public directory. Rotate credentials after accidental exposure and after staff or automation access changes.

Review ownership and permissions for application code, upload directories, SSH keys, backups, and configuration files. Private SSH keys should not be readable by other users. Web processes should have write access only to directories that genuinely require it, such as an uploads directory.

Ensure authentication events, privilege use, firewall actions, web requests, application errors, and backup results are logged according to your operational needs. Centralized logs or an external monitoring service can preserve evidence if the VPS is compromised. Avoid relying on local logs alone.

Backups and recovery

Backups are part of security hardening because an incident may require rebuilding rather than cleaning an affected server. Maintain backups separate from the VPS and protect them with access controls. Back up databases using a database-aware method, not only filesystem snapshots. Define retention, encryption, and who can restore data.

Perform a test restore on a schedule. Confirm that the restored application can start, that files and database records are consistent, and that DNS, TLS, environment variables, and permissions can be recreated. A backup that has never been restored is an assumption, not a recovery plan.

Cadence and checkpoints

Use a simple recurring schedule rather than waiting for a suspected incident.

  • After initial provisioning: create named users, test SSH recovery, configure the firewall, patch the system, remove unnecessary services, set up backups, and record the baseline.
  • Monthly: review pending updates, listening ports, administrator accounts, failed login patterns, backup results, disk usage, and provider-console access.
  • Quarterly: test a restore, review firewall rules against the application inventory, inspect sudo access, rotate credentials where appropriate, and verify monitoring alerts.
  • After every deployment: check newly exposed ports, file ownership, secrets handling, logs, health checks, and rollback steps. The small-team production deployment checklist can help structure this review.
  • After a team or provider change: remove former accounts and keys, review tokens, confirm domain and DNS ownership, and reassess who can access backups and the hosting console.

Keep a dated change record containing the reason for each change, the commands or files affected, the test performed, and the rollback method. This turns security maintenance into an auditable operational process.

How to interpret changes

A new listening port is not automatically malicious, but it is a change that needs an owner and an explanation. Compare it with deployment records and the intended application architecture. An unexpected service, unfamiliar administrator key, repeated authentication failures, changed firewall rules, unexplained outbound traffic, or altered files deserves investigation rather than immediate deletion.

Separate routine noise from meaningful signals. Internet-facing SSH commonly receives automated login attempts; rate-limiting and key-based access can reduce exposure, but repeated attempts alone do not prove compromise. Look for successful logins from unfamiliar locations, unexpected privilege escalation, new users, modified scheduled tasks, suspicious processes, and changes outside the deployment workflow.

If compromise is plausible, do not rely on the affected server as your only source of truth. Restrict network access, preserve relevant logs, use the provider’s recovery controls, rotate credentials from a trusted system, and consider rebuilding from a known-good image. Restore application data only after validating its integrity. For critical workloads, document an incident procedure before it is needed.

Interpret resource changes alongside security changes. A sudden increase in CPU, memory, disk, or outbound traffic may reflect a legitimate deployment, but it can also indicate abuse, a runaway process, or a compromised account. Monitoring should alert on thresholds appropriate to the workload and should route alerts to a person or system that can act.

When to revisit

Revisit this Linux VPS security hardening checklist at least monthly for lightweight review and quarterly for a deeper audit. Return immediately after a major operating-system release, distribution upgrade, SSH or firewall change, provider-console change, new public service, application migration, new team member, credential rotation, incident, or backup-system change. Also review it before placing a new production website or open-source application on an existing VPS.

During each review, compare the current server with the documented baseline: operating-system and package status, users and SSH keys, sudo rules, listening ports, firewall policies, running services, secrets locations, log coverage, backup results, and restore evidence. Mark each item as confirmed, changed with a reason, or requiring action.

Finish with a controlled verification workflow:

  1. Connect using a new administrator session and confirm the intended SSH policy.
  2. Check listening ports locally and test only the expected public ports externally.
  3. Confirm that required web, application, database, and scheduled-job functions work.
  4. Review recent authentication, privilege, firewall, application, and backup logs.
  5. Verify that monitoring alerts and provider notifications reach the right recipient.
  6. Record the review date, findings, owner, and next checkpoint.

Security hardening is most effective when it remains small enough to understand and regular enough to maintain. A documented baseline, least-privilege access, minimal exposure, dependable updates, and tested recovery provide a practical foundation for hosting websites and applications on a Linux VPS.

Related Topics

#VPS#Linux#server security#Ubuntu#Debian#SSH#DevOps
O

OpenWebHosting Editorial Team

Cloud Infrastructure Editor

Senior editor and content strategist. Writing about technology, design, and the future of digital media. Follow along for deep dives into the industry's moving parts.