Home Guides Host a dedicated server

How to host an s&box dedicated server on Linux

Updated

Install the s&box server with SteamCMD, give it a server token so it keeps its Steam ID, and run it in Docker or under systemd.

What you need

A dedicated server runs the game without a screen: no rendering, only the simulation, physics and network traffic, around the clock. A listen server runs on a player's own PC and goes away when they quit. A dedicated server stays up, takes connections from anyone, and builds a 30-day uptime history on sboxlist.

To show up in the in-game server browser and on sboxlist, and to keep the same server identity when you rebuild a container, you need three things: the Steam client binaries linked as Facepunch's dedicated server documentation describes, UDP ports for game traffic (27015) and queries (27016), and a Steam Game Server Login Token (GSLT).

1. Install the server with SteamCMD

Facepunch ships the dedicated server through SteamCMD as App ID 1892930 (the game itself is App ID 590830). SteamCMD downloads and verifies it with an anonymous login, so your own Steam account never touches the server machine.

  1. Create a user for the server (sbox), so it does not run as root.
  2. Install the server into that user's folder. The commands are below.
  3. Link the Steam client binaries into ~/.steam/sdk64/. The Facepunch dedicated server page has the steps.
# Create an unprivileged service user and installation directory
sudo useradd -r -m -d /opt/sbox-server -s /usr/sbin/nologin sbox
sudo -u sbox steamcmd \
  +force_install_dir /opt/sbox-server \
  +login anonymous \
  +app_update 1892930 validate \
  +quit

2. Get a server token

Without a Game Server Login Token, sbox-server signs in to Valve's master server anonymously and gets a new SteamID every time it restarts or updates. Players then lose it from their favorites and history.

Create a token at steamcommunity.com/dev/managegameservers with App ID 590830 and pass it with +net_game_server_token. Load it from an environment variable; do not write it into a script other people can read.

./sbox-server \
  +game facepunch.sandbox facepunch.construct \
  +hostname "EU Sandbox Builders | Active Staff" \
  +port 27015 \
  +net_query_port 27016 \
  +net_game_server_token "${SBOX_GSLT}"

3. Run it in Docker

A container keeps the SteamCMD runtime apart from the rest of the machine and makes nightly updates easy. The example is for Ubuntu 24.04 or Debian 12. Two settings matter: map UDP ports 27015 and 27016 explicitly on the host, and set stop_grace_period: 15s so the server can save player data and leave the Steam master server list before Docker sends SIGKILL.

services:
  sbox-dedicated:
    image: ghcr.io/steamcmd/steamcmd:ubuntu-24
    container_name: sbox-dedicated
    user: "1000:1000"
    restart: unless-stopped
    stop_signal: SIGTERM
    stop_grace_period: 15s
    environment:
      SBOX_GSLT: "${SBOX_GSLT}"
    ports:
      - "27015:27015/udp"
      - "27016:27016/udp"
    volumes:
      - ./data/server:/data/server
    entrypoint:
      - /bin/bash
      - -ec
      - |
        steamcmd +force_install_dir /data/server +login anonymous +app_update 1892930 validate +quit
        exec /data/server/sbox-server +game facepunch.sandbox facepunch.construct +port 27015 +net_query_port 27016 +net_game_server_token "$${SBOX_GSLT}"

Or run it with systemd

Without Docker, use a systemd unit. The one below updates the server before every start (ExecStartPre), reads its secrets from /etc/sbox/server.env (chmod 0600) and restarts the server after a crash.

[Unit]
Description=s&box Dedicated Server (App ID 1892930)
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=sbox
Group=sbox
WorkingDirectory=/opt/sbox-server
EnvironmentFile=/etc/sbox/server.env
ExecStartPre=/usr/games/steamcmd +force_install_dir /opt/sbox-server +login anonymous +app_update 1892930 validate +quit
ExecStart=/opt/sbox-server/sbox-server +game ${SBOX_GAME} ${SBOX_MAP} +port 27015 +net_query_port 27016 +net_game_server_token ${SBOX_GSLT}
KillSignal=SIGTERM
TimeoutStopSec=15
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

4. Open the ports and check security

Check these before you let players in.

  • Open UDP 27015 and UDP 27016 inbound (ufw allow 27015:27016/udp) for game traffic and Steam A2S_INFO queries.
  • Allow outbound HTTPS (TCP 443) and the Steam UDP ports, for package downloads, Steam sign-in and the sboxlist plugin.
  • On servers with 32 to 64 slots, raise the kernel's UDP socket buffers (net.core.rmem_max=16777216 and net.core.wmem_max=16777216) so bursts of packets are not dropped.
  • Run the server as an unprivileged user (UID 1000 or sbox), never as root.
  • Keep secrets (SBOX_GSLT and your sboxlist server secret) in a 0600 .env file that Git ignores (*.env in .gitignore).

Quick reference

SettingValue
SteamCMD App ID1892930 (anonymous login works)
UDP ports27015/udp (game traffic) and 27016/udp (queries)
Stop signalSIGTERM with a 15-second stop_grace_period
Token flag+net_game_server_token <GSLT>

Tool: Server configurator.

Unofficial and general. The s&box API changes between versions; check the Facepunch documentation before you copy code.