What is linux server hardening and what does it involve?

Linux server hardening reduces unnecessary attack surface by tightening authentication, network exposure, service configuration, permissions, patch posture, logging and recovery controls. TechSteps applies hardening in the context of the workload, so a security change does not quietly break the application it is meant to protect.

What this solves

The problem underneath the request.

Most servers are configured to work rather than configured to be secure, and the difference is largely about what is left switched on. Default installations expose services nobody uses, permit authentication methods nobody needs, and log almost nothing useful.

The opposite failure is equally common. A hardening script is run, it applies a hundred changes derived from a generic benchmark, and something breaks. Nobody knows which change caused it, so the whole thing is reverted and hardening is written off as disruptive.

Useful hardening is specific to the workload. It requires knowing what the server actually does, so exposure can be removed without removing function.

Who this is for

  • Businesses running production Linux servers reachable from the internet
  • Companies whose servers were set up quickly and never revisited
  • Teams facing a client or insurer security requirement
  • Anyone who has had a compromise and wants the surface reduced
  • Organizations preparing for a compliance assessment

When people call us

Situations that usually start this conversation.

If more than one of these sounds familiar, the underlying cause is often a single issue rather than several separate ones.

  • 01 Authentication logs show constant brute force attempts
  • 02 A security questionnaire asks about server configuration
  • 03 The server was built from a provider default image and never reviewed
  • 04 A compromise happened and the entry point is not fully understood
  • 05 Services are exposed that you did not know were running
  • 06 You are about to put a new server into production

Technical scope

What the work actually covers.

Not every engagement includes all of this. The scope is agreed in writing before we start, and anything excluded is named rather than left ambiguous.

Authentication and access

  • SSH key authentication with password login disabled
  • Root login policy and use of privileged escalation
  • Sudo configuration reviewed for unintended privilege
  • Named accounts rather than shared logins
  • Removal of dormant accounts and stale authorized keys

Network exposure

  • Firewall configured to allow only what is needed
  • Inventory of listening services and justification for each
  • Binding internal services to localhost rather than all interfaces
  • Administrative interfaces restricted by source address where practical
  • Rate limiting and brute force protection

Services and permissions

  • Removal of packages and services not in use
  • Web server and application boundary review
  • File ownership and permissions, particularly on writable directories
  • Secrets moved out of world-readable files
  • Process isolation where the workload supports it

Visibility and recovery

  • Audit logging of authentication and privilege escalation
  • Log shipping so evidence survives a compromise of the host
  • Package posture and a patching cadence
  • Backups verified by restoring
  • A documented baseline of the expected state

How we approach it

The order matters more than the checklist.

  1. 01

    Understand the workload first

    What the server runs, what talks to it, what it talks to. Hardening applied without this is how a security change becomes an outage.

  2. 02

    Inventory the current state

    Listening sockets, running services, accounts, keys, sudo rules, cron entries and open firewall ports. This is the baseline and it is also frequently where surprises appear.

  3. 03

    Remove before restricting

    A service that is uninstalled cannot be exploited. Reducing what exists is more durable than configuring around it.

  4. 04

    Change in stages, verify each

    Applied in reviewable groups with the application checked after each. This is the difference between hardening that survives and hardening that gets reverted wholesale.

  5. 05

    Keep a way back in

    Console access confirmed before changing SSH configuration. Locking yourself out of a production server is an avoidable and surprisingly common outcome.

  6. 06

    Document and baseline

    What was changed, why, and what the server should now look like. Future drift becomes a diff rather than an investigation.

What goes wrong

How this work fails when it is done badly.

These are the patterns we see most often when we are called in to fix someone else's work, or our own from earlier in our careers.

  • A generic benchmark applied wholesale

    A hundred changes at once from a standard nobody tailored. Something breaks, the cause is unclear, everything is reverted, and the server ends up less secure than a careful subset would have made it.

  • SSH locked down without console access

    Password authentication disabled, key configuration wrong, no out-of-band access. Now the server is secure from everyone including you.

  • Firewall rules that ignore internal traffic

    Public ports closed while a database still listens on all interfaces on a shared network. The exposure moved rather than disappeared.

  • Hardening with no logging

    The surface is reduced and nothing is recorded. After an incident there is no evidence, so the entry point is never established and the fix is guesswork.

  • Applied once and never revisited

    Configuration drifts as software is installed and people are added. Hardening is a posture to maintain, not a task to complete.

What each side brings

What we need from you

  • Root or equivalent access
  • Console or out-of-band access as a fallback
  • A description of what the server does and what depends on it
  • A maintenance window for changes that require a service restart
  • A contact who can confirm the application still works

What you get

  • A documented inventory of the pre-hardening state
  • Applied changes, grouped and explained
  • Firewall and exposed service configuration
  • Audit logging with off-host collection
  • A documented baseline of the expected state
  • A list of changes deliberately not applied, with the reasoning

Where we stop

  • Hardening reduces attack surface. It does not protect against a vulnerability in the application itself, which is separate work.
  • Some hardening is incompatible with specific workloads. Where that is true we will tell you and record it as an accepted risk rather than applying it and hoping.
  • A hardened server still needs patching, monitoring and backups. Hardening is one layer, and on its own it is not a security programme.

Questions we actually get asked

Straight answers.

Will hardening break our application?

Not if it is done in the context of the workload and applied in stages with verification. Breakage comes from applying a generic benchmark blindly. We change things in reviewable groups and confirm the application after each, which takes longer and is the reason it stays applied.

Is a hardening script enough?

It is a reasonable starting point and a poor finishing point. A script does not know which services your application needs, which ports must stay open or which permissions a workload depends on. It also cannot tell you what it decided not to do. The value is in the judgement, not the checklist.

How often should this be revisited?

The baseline should be checked periodically, because servers drift as software is installed and people come and go. An annual review is a reasonable minimum for a stable server, and continuous baseline monitoring is better where the risk justifies it.

What is the single highest-value change?

Usually reducing what is exposed to the internet at all. Most compromises begin with something reachable that did not need to be. After that, key-based SSH with passwords disabled, and a patching cadence you actually keep.

Do we need this if we are behind Cloudflare?

Yes. Cloudflare protects traffic that goes through it. If your origin server IP is discoverable, and it often is, an attacker can connect to it directly and bypass the edge entirely. Restricting the origin to accept traffic only from your edge provider is part of this work.

Harden My Server.

Describe the system and what is going wrong with it. A short technical conversation is usually enough for us to tell you whether this is the right work and roughly what it involves.