A secure production server is built through a sequence of verifiable decisions, not a single hardening script. This checklist covers identity, SSH access, patching, network controls, least privilege, secrets, logging, backups, monitoring, and rollback testing so you can bring a Linux server online with fewer avoidable risks and a repeatable process for future builds.
Overview
Before a new VPS, dedicated server, or bare-metal host accepts public traffic, establish who can access it, what services it must run, how it will be updated, and how it can be recovered. Hardening is most effective when these decisions are recorded and tested before an incident occurs.
Start with a written inventory. Record the operating system and release, hostname, IP addresses, intended workloads, listening services, data classification, backup destination, monitoring endpoint, and the person or team responsible for each area. The inventory should distinguish between the server itself and external dependencies such as a database, object storage service, DNS provider, identity provider, or payment system.
Use a supported operating-system release and apply the provider's security guidance for that release. Commands differ between distributions and can change between major versions, so validate each command in a non-production environment rather than copying an old hardening script without review. For a wider provisioning sequence, see the bare-metal server deployment runbook.
A useful principle is to make every control observable. You should be able to answer questions such as: which accounts can log in, which ports are reachable, when the last successful backup completed, whether logs are being received, and how long a replacement server would take to become operational.
What to track
1. Identity and SSH access
Create named administrator accounts rather than sharing a root login. Use individual SSH keys or another approved strong authentication method, and store recovery credentials in a controlled password or secrets manager. Confirm that each administrator can authenticate with their own account before changing the emergency access settings.
After testing an alternative administrative path, restrict direct root login and password-based SSH authentication where your recovery process permits it. Limit SSH exposure by network source when practical, but do not treat an allowlist as a replacement for strong authentication. Record the SSH port and firewall rule so that a future operator can distinguish intentional exposure from an accidental change.
Review membership of privileged groups and remove dormant accounts promptly. Keep a break-glass procedure, but protect it with documented approval, strong credentials, limited use, and an audit trail. A quarterly access review should identify accounts that are no longer needed, keys that have not been rotated, and permissions that exceed a user's current role.
2. Patching and system configuration
Update package metadata and install security updates before deployment. Enable only the operating-system repositories and third-party sources required by the workload. Pinning or change control may be appropriate for application dependencies, but do not allow it to obscure urgent operating-system security updates.
Record the kernel, installed packages, time zone, time synchronisation status, disk layout, and configuration-management version. Remove unused packages and disable services that are not required. Ensure the server clock is synchronised because inaccurate time can complicate authentication, certificates, log correlation, and incident investigation.
3. Firewall and exposed services
Build the firewall from a deny-by-default position for unsolicited inbound traffic, then add only the ports required for administration, application traffic, health checks, and approved integrations. A common web workload may need HTTP and HTTPS, while database and internal administration ports should normally be reachable only from defined private networks or trusted hosts.
Check the result from outside the server. Review both the host firewall and any controls supplied by the VPS or data-centre provider. Scan for listening services with the operating system's tools, compare the result with the service inventory, and investigate every unexpected port. If IPv6 is enabled, apply equivalent rules and test it separately; an IPv4-only review does not establish IPv6 security. Use the IPv6 hosting readiness checklist when preparing dual-stack services.
4. Least privilege and application isolation
Run each application under a dedicated service account where possible. Keep application files, uploaded content, logs, and configuration files separated according to their access needs. Avoid granting a web process write access to its code and system directories unless the design explicitly requires it.
Review scheduled tasks, systemd units, container permissions, sudo rules, file ownership, and shared directories. If the server hosts several applications, isolate them by user, process, network policy, or separate virtual machines according to the risk and operational requirement. Least privilege should cover automation accounts as well as human users.
5. Secrets and certificates
Do not place passwords, private keys, API tokens, or database credentials in public repositories, shell history, issue trackers, or world-readable configuration files. Prefer an approved secrets manager or a protected deployment mechanism. Give each integration its own credential so that one token can be revoked without interrupting unrelated services.
Document certificate ownership, renewal method, storage location, and expiry monitoring. Test renewal before the first certificate approaches expiry. If a secret may have been exposed, rotate it and review access logs rather than merely editing the configuration file.
6. Logging and monitoring
Forward important authentication, privilege, firewall, application, and system logs to a separate destination when the workload justifies it. Local logs alone may be lost if the server is compromised or the disk fails. Restrict access to collected logs and define a retention period that fits operational, contractual, and compliance requirements.
Monitor more than uptime. Track disk capacity and inode usage, memory pressure, CPU saturation, filesystem errors, certificate expiry, backup status, service health, and unusual authentication activity. Alerts should identify an owner and include enough context to begin triage. Test alerts deliberately; an untested alert is an assumption.
7. Backups, restoration, and rollback
Define what must be recovered: application data, databases, uploaded files, configuration, secrets, infrastructure definitions, and DNS or deployment settings. Use backups that are separated from the production server and protect them against unauthorised deletion. Encryption may be appropriate for data at rest and in transit, but document how recovery keys are obtained.
Measure backup age and restoration time, not just whether a backup job reports success. Restore a representative file and, at planned intervals, perform a complete recovery into an isolated environment. Confirm database consistency and application startup. For deployments, keep a known-good image, package set, or release artifact and document the rollback command or procedure.
Cadence and checkpoints
Use the following schedule as a practical operating rhythm, adapting it to the workload's risk and change rate:
- Before go-live: verify named access, SSH recovery, patch level, firewall rules, listening ports, service accounts, secrets handling, TLS, logging, monitoring, backups, restoration, and rollback.
- After every material change: compare the change against the inventory, review new ports and permissions, check application health, and confirm that monitoring and backups still work.
- Monthly: review failed logins, privileged access, package updates, certificate dates, disk growth, backup failures, and unresolved security alerts.
- Quarterly: remove inactive accounts and keys, test a restoration, exercise rollback, review firewall rules, inspect third-party access, and confirm that documented owners remain correct.
- After an incident: preserve relevant logs, rotate potentially exposed credentials, rebuild rather than relying on uncertain cleanup where appropriate, and update the deployment checklist with the lesson learned.
Keep evidence with the server record: the latest access review, firewall export, backup restoration result, patch status, monitoring test, and approval for exceptions. This creates a useful handover trail whether the workload runs in a VPS, a dedicated server, a colocation facility, or a hybrid cloud environment.
How to interpret changes
Not every change signals an attack, but unexpected change deserves an explanation. A sudden increase in failed SSH authentication may reflect a newly exposed address, a broken deployment key, or automated scanning. Check source addresses, account names, timing, and successful sessions before deciding on a response.
Rapid disk growth can result from legitimate traffic, an unbounded log, a failed cleanup job, or unwanted files. Investigate the largest directories and recent changes, then preserve evidence before deleting anything if compromise is possible. A rise in CPU or memory use may indicate a traffic spike, a workload regression, a runaway process, or resource contention on shared infrastructure.
Interpret availability together with dependencies. If the application is healthy locally but inaccessible externally, review DNS, provider networking, firewall rules, load balancers, and upstream services. If backups succeed but restoration fails, treat the backup process as incomplete. If a hosting uptime SLA exists, retain your own monitoring and incident records; a percentage in a contract does not replace operational evidence. The hosting uptime SLA comparison guide provides a framework for examining what an availability guarantee actually covers.
When a control is not feasible, record the exception, its reason, compensating controls, owner, and expiry or review date. Temporary exceptions become permanent risks when nobody is responsible for revisiting them.
When to revisit
Revisit this secure server deployment checklist at least monthly for operational signals and at least quarterly for access, backup, and configuration reviews. Update it after a major operating-system release, a change to the hosting provider, a new public service, an incident, a compliance requirement, or a change in data residency expectations. Review the commands and package names whenever the supported operating system changes; examples that worked on one release may be inappropriate on another.
Before declaring a server production-ready, complete this go-live check:
- Named administrators can access the server, and an approved recovery path has been tested.
- Root and password-based SSH access are restricted according to the documented policy.
- The operating system and required packages are patched, with unnecessary services removed or disabled.
- Inbound firewall rules match the service inventory for both IPv4 and IPv6 where applicable.
- Applications run with the minimum practical privileges, and secrets are not embedded in code or public files.
- Authentication and system logs are retained and, where appropriate, sent away from the host.
- Monitoring covers service health, resources, certificates, authentication events, and backup status.
- A recent backup has been restored successfully, and the recovery keys and instructions are available.
- A known-good release or image can be restored, and rollback ownership is clear.
- The inventory, exceptions, contacts, and next review date are recorded.
Save the completed checklist with the deployment record and reuse it for migrations, incident remediation, and quarterly access reviews. For workload sizing decisions before deployment, compare VPS and bare metal for production workloads; for regulatory considerations, review the GDPR and data residency hosting checklist.