Skip to main content
Servers Are Up
Virtual Datacenter
PricingFree Tools
Sign inBrowse catalog
Servers Are Up
Virtual Datacenter
PricingFree Tools
Sign inBrowse catalog

Loading…

Servers Are Up

Your apps, automation and data on hardware we own. Build a private stack with predictable capacity and access through your dashboard, API or SSH.

SLA with service creditsOwned hardwareUS-based

Make room for your next idea

Explore the capacity, apps and access options that fit your workload. Check current availability and your total before you buy.

Sign up freeView Pricing

Products

  • Linux VPS
  • Windows VPS
  • Cloud & SaaS Services
  • Cloud Storage (Azure)
  • Virtual Datacenter
  • AI & Agent Hosting
  • Containers
  • Instant Apps
  • Software Platforms
  • Network builder
  • Game Servers
  • Free Game Servers
  • Pricing

Resources

  • Free Network Tools
  • 2026 Pricing Benchmark
  • Live SVG Badges
  • Latency & Speed Test
  • Guides & Tutorials
  • Documentation
  • API Reference
  • MCP Server
  • CLI & SDKs
  • OpenAPI & llms.txt
  • Use Cases
  • Free Migration
  • Uptime & Reliability
  • Datacenter
  • System Status
  • Network
  • Provider Comparisons Hub
  • Compare Providers

Company

  • About Us
  • Enterprise
  • Security Architecture
  • Trust Center
  • Blog
  • FAQ
  • Compliance
  • Startup Program
  • Open-Source Sponsorship
  • Press & Media Kit
  • Referral Program
  • Help Center
  • Contact Us
© Servers Are Up
TermsPrivacySLARefund PolicyDPAAcceptable Use
Service information
Docs
  • Documentation Hub
  • Technical Knowledge Library
    Runbooks & 187 Blueprints
  • Choose a Product
    VMs, Containers & Cloud
  • First Linux Server
    SSH, Firewall & Apps
  • Windows Server 2025
    BYOL & Remote Desktop
  • Remote Access
  • Troubleshooting
  • FAQ
  • All Product Guides
    29 Step-by-Step Guides
  • Cloud & SaaS Catalog
    112 Cloud & SaaS Offerings
  • Azure Cloud Storage
    Hot/Cool/Archive & WORM
  • Resource Manager & RBAC
    Groups, Tags & Locks
  • Multi-Model Cloud DB
    JSONB, SQL & pgvector
  • Cloud Identity & ZTNA
    OIDC, SCIM & PIM
  • Key Vault & KMS
    Secrets & Envelope Keys
  • Cloud SIEM, SOAR & DLP
    Posture & Threat Response
  • API Gateway & Cloud DNS
    Edge WAF & DNS Zones
  • Serverless, Workflows & IoT
    Functions, Queues & DAGs
  • SaaS, Governance & Vault
    Budgets & Off-Host GRS
  • Linux Systems & Kernel
    SSH, UFW, sysctl & OOM
  • Self-Hosted Apps & Stacks
    Caddy, Nextcloud & Auth
  • Build Web Apps with AI
  • Next.js and React
  • TypeScript and Node.js
  • npm and Tooling
  • Data and APIs
  • Deploy and Operate
  • Tutorials
  • Infrastructure
  • Automation & Regions
  • API Overview
  • API v1 Reference
    Endpoints & 23 Scopes
  • MCP Server
    129 AI Agent Tools
  • Swagger / OpenAPI 3.1
  • API Playground
  • Versioning & Sunset
  • API Token Security
    Authentication & Tokens
  • Instances API
    Compute Resources
  • Networking API
    Networks & Ports
  • Storage API Availability
    Volumes & Backups
  • Webhooks & Events
    Event Notifications
  • Rate Limits & Best Practices
    Throttling & Retries
  • sau CLI Reference
    34 Commands (v0.2)
  • Browser Web CLI
  • SDKs
  • Infrastructure as Code
    Terraform & Ansible
  • Code Examples
  • CLI & SDK Guides
  • Security Guides
  • Security at a Glance
  • Zero Trust Architecture
  • Live Trust Center
  • Compliance
Need help?

Loading documentation...

Documentation/linux systems

Harden OpenSSH and sandbox systemd services cleanly

Lock down sshd with drop-in cryptography, disable password auth, and apply systemd service sandboxing directives validated with systemd-analyze security.

Intermediate
25 min
Updated 2026-11-23

Deploy Ready-to-Run Infrastructure in Seconds

Linux VMs from $6/mo · Pooled Virtual Datacenters from $12/mo · Use code WELCOME20 for 20% off your first order.

Browse ServersView Pricing

Commands checked on 2026-11-23 with OpenSSH 9.6+, systemd 255+, Ubuntu 24.04, Rocky Linux 9.

What you will have at the end

An OpenSSH daemon hardened with modern post-quantum hybrid key exchange and key-only authentication, paired with isolated systemd service drop-ins verified by sshd -t and systemd-analyze security.

Before you start

  • SSH public key authentication tested and working for a sudo-capable non-root user; see Administer Ubuntu, Debian, Rocky, and AlmaLinux servers cleanly.
  • Browser Console access open as a safety net while testing SSH daemon reloads.

Steps

1. Apply OpenSSH drop-in hardening under sshd_config.d

Never edit /etc/ssh/sshd_config inline when /etc/ssh/sshd_config.d/*.conf drop-ins are supported. Note that OpenSSH uses the first matching directive, so place overrides in a low-numbered drop-in or remove vendor cloud-init password overrides such as 50-cloud-init.conf:

sudo ls -la /etc/ssh/sshd_config.d/
sudo tee /etc/ssh/sshd_config.d/01-hardening.conf >/dev/null <<'EOF'
PermitRootLogin prohibit-password
PubkeyAuthentication yes
PasswordAuthentication no
PermitEmptyPasswords no
KbdInteractiveAuthentication no
MaxAuthTries 3
LoginGraceTime 20s
X11Forwarding no
AllowAgentForwarding no
ClientAliveInterval 300
ClientAliveCountMax 2
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com
EOF

Optionally enforce post-quantum hybrid key exchange on OpenSSH 9.x+ hosts (KexAlgorithms sntrup761x25519-sha512@openssh.com,curve25519-sha512,ecdh-sha2-nistp521) after verifying ssh -Q kex | grep sntrup761.

2. Validate sshd syntax and inspect effective runtime settings

Never restart SSH without validating syntax and checking the merged effective configuration with -T:

sudo sshd -t
sudo sshd -T | grep -E '^(permitrootlogin|passwordauthentication|pubkeyauthentication|kbdinteractiveauthentication) '

Reload without breaking your current session (Ubuntu 24.04 socket-activated ssh.socket vs traditional ssh/sshd):

sudo systemctl reload ssh 2>/dev/null || sudo systemctl reload sshd

3. Score an existing systemd unit's exposure

Systemd ships a built-in exposure auditor for running services:

systemd-analyze security nginx.service 2>/dev/null || systemd-analyze security ssh.service

Look for EXPOSED or UNSAFE scores (> 7.0) caused by full filesystem write access, missing capability bounding, or shared /tmp.

4. Add a systemd drop-in sandbox override

Create an override via systemctl edit <unit> (or write /etc/systemd/system/<unit>.service.d/hardening.conf) for application daemons such as Node.js web APIs or Caddy:

sudo mkdir -p /etc/systemd/system/webapp.service.d
sudo tee /etc/systemd/system/webapp.service.d/hardening.conf >/dev/null <<'EOF'
[Service]
NoNewPrivileges=true
ProtectSystem=strict
ProtectHome=true
PrivateTmp=true
PrivateDevices=true
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectKernelLogs=true
ProtectControlGroups=true
RestrictSUIDSGID=true
LockPersonality=true
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
CapabilityBoundingSet=
ReadWritePaths=/var/lib/webapp
EOF

When using ProtectSystem=strict, grant write access explicitly via ReadWritePaths= (or StateDirectory=webapp) so the daemon can still persist uploads or SQLite/state files.

5. Reload daemon units and re-score

sudo systemctl daemon-reload
sudo systemctl restart webapp.service 2>/dev/null || true
systemd-analyze security webapp.service 2>/dev/null || true

Check that it works

Test key-only enforcement from an external workstation using verbose SSH debug flags without an identity loaded:

ssh -o PubkeyAuthentication=no -o PreferredAuthentications=password -v user@YOUR_SERVER_IP

OpenSSH should immediately reject with Permission denied (publickey) without prompting for a password.

What can go wrong

  • Locked out after disabling passwords. Connect through your dashboard Browser SSH/noVNC Console (out-of-band), run sudo sshd -t, inspect /etc/ssh/authorized_keys, and fix /etc/ssh/sshd_config.d/.
  • Ubuntu 24.04 ignores Port edits in sshd_config. Ubuntu 24.04 uses ssh.socket socket activation by default. Override [Socket] ListenStream= with sudo systemctl edit ssh.socket followed by sudo systemctl daemon-reload && sudo systemctl restart ssh.socket.
  • Service crashes with Read-only file system or Permission denied after sandboxing. ProtectSystem=strict mounted its state directory read-only. Add the target directory to ReadWritePaths= or StateDirectory= and inspect exact denials via journalctl -u <unit> -n 40.

Good practice

  • Leave /etc/ssh/sshd_config untouched and keep site overrides cleanly separated in /etc/ssh/sshd_config.d/01-hardening.conf.
  • Generate ed25519 user keys (ssh-keygen -t ed25519 -C "ops@YOUR_DOMAIN") rather than legacy 2048-bit RSA keys.
  • Test systemd-analyze security incrementally so NoNewPrivileges=true and ProtectHome=true never break unit scripts stored under /home.

Where to go next

  • Fix Docker UFW bypasses with DOCKER-USER and nftables
  • Administer Ubuntu, Debian, Rocky, and AlmaLinux servers cleanly
  • Firewall and port forwarding on Servers Are Up

Related Articles

Fix Docker UFW bypasses with DOCKER-USER and nftables

Read more

Diagnose Linux OOM kills, sysctl limits, and disk spikes

Read more

Administer Ubuntu, Debian, Rocky, and AlmaLinux servers cleanly

Read more

Frequently Asked Questions

What does the Harden OpenSSH and sandbox systemd services cleanly documentation guide cover?
Lock down sshd with drop-in cryptography, disable password auth, and apply systemd service sandboxing directives validated with systemd-analyze security. It is rated intermediate difficulty (25 min) and applies to Servers Are Up infrastructure and workflows.
Can I manage or automate these steps through the Servers Are Up dashboard, REST API v1, or MCP server?
Yes. Every Servers Are Up server includes browser-based SSH, WebRDP, and VNC console access in the dashboard, plus programmatic control via the REST API v1 (/api/v1) and hosted Model Context Protocol server (/api/mcp/v1) using a scoped Personal Access Token.

Need hands-on help with Harden OpenSSH and sandbox systemd services cleanly?

Every Servers Are Up virtual machine and container includes an integrated HTML5 browser-based SSH, RDP, and VNC console in your dashboard, default-off inbound firewall rules with per-IP allow-lists, and full programmatic control via REST API v1 and Model Context Protocol (MCP). Explore our Virtual Datacenter Plans or reach out to Servers Are Up Support.

Was this article helpful?

On this page

What you will have at the endBefore you startSteps1. Apply OpenSSH drop-in hardening under sshd_config.d2. Validate sshd syntax and inspect effective runtime settings3. Score an existing systemd unit's exposure4. Add a systemd drop-in sandbox override5. Reload daemon units and re-scoreCheck that it worksWhat can go wrongGood practiceWhere to go next
Need Live Commands?

Open Aria in Wide Engineering Mode for distro-specific commands, compose tweaks, and isolated environment troubleshooting.

Knowledge Library