How to Create an S&box Server
Complete guide to install a dedicated S&box server on a VPS or dedicated Linux server: SteamCMD, dedicated user, systemd service, console, updates, backup and troubleshooting.
On this page
This guide explains how to install a dedicated S&box server on your VPS or dedicated Linux server, run it with a dedicated user and a systemd service, then administer it and keep it up to date.
Order a Server
To host your S&box server, HostMyServers offers several options:
- Performance VPS - Dedicated resources and fast processors, ideal for S&box
- NVMe VPS - For a small server or a test server
- Eco Dedicated Servers - For servers with many players
- Performance Dedicated Servers - Maximum performance
Prerequisites
- SSH access as root or user with sudo privileges
- 64-bit x86-64 Linux system: Debian 13 or Ubuntu 24.04
- Active firewall: nftables (recommended), iptables or ufw (use only one firewall tool at a time)
- Outbound Internet access to Steam, required at startup
- Ports 27015 UDP and 27016 UDP accessible
- The S&box game on Steam, on each player's computer
Required Configuration
Facepunch does not publish a minimum configuration for the dedicated server. The values below are rough estimates to get started: actual consumption mainly depends on the loaded game and the number of players.
| Component | To get started | Recommended |
|---|---|---|
| RAM | 4 GB | 8 GB and more |
| CPU | 2 x86-64 cores | 4 cores or more, high frequency |
| Storage | 20 GB SSD | 40 GB NVMe SSD |
The server files take up about 4.5 GB. Add to that the games and maps downloaded at startup.
System Update
sudo apt update && sudo apt upgrade -yThen check the system version:
grep PRETTY_NAME /etc/os-releaseInstalling Dependencies
The server ships with its own .NET environment: you do not need to install it. It does need a few system libraries, though, and SteamCMD requires lib32gcc-s1.
On Debian 13:
sudo apt install -y ca-certificates curl tar screen cron lib32gcc-s1 libfontconfig1 libuuid1 libssl3t64 libicu76On Ubuntu 24.04:
sudo apt install -y ca-certificates curl tar screen cron lib32gcc-s1 libfontconfig1 libuuid1 libssl3t64 libicu74Creating a Dedicated User
The server must never run as root. Create a dedicated user:
sudo adduser --disabled-password --gecos "" sboxPorts Used
| Port | Protocol | Usage | Parameter |
|---|---|---|---|
| 27015 | UDP | Game | +port |
| 27016 | UDP | Queries (player count, current map) | +net_query_port |
These are the engine's default values. By default, players go through Steam's relay: the server's IP address is not shared with them. Facepunch's documentation does not say whether these ports are still required with the relay, so open them as a precaution.
S&box has no administration port to open: the server console is only accessible from your SSH session.
Firewall Configuration
With UFW
sudo ufw allow 27015/udp
sudo ufw allow 27016/udp
sudo ufw reloadWith iptables
sudo iptables -A INPUT -p udp --dport 27015 -j ACCEPT
sudo iptables -A INPUT -p udp --dport 27016 -j ACCEPT
sudo iptables-save | sudo tee /etc/iptables/rules.v4Saving the rules across reboots requires the iptables-persistent package.
With nftables
These commands use the inet filter table and the input chain, present by default in /etc/nftables.conf on Debian.
sudo nft add rule inet filter input udp dport 27015 accept
sudo nft add rule inet filter input udp dport 27016 accept
(echo "flush ruleset"; sudo nft list ruleset) | sudo tee /etc/nftables.confInstalling SteamCMD
Log in as the sbox user, then create the directories and download SteamCMD:
sudo -iu sbox
mkdir -p ~/steamcmd ~/sbox-server ~/logs ~/.steam/sdk64
cd ~/steamcmd
curl -sqL https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz | tar -xzf -Downloading the S&box Server
Start the server installation (application ID 1892930), still as the sbox user:
./steamcmd.sh +force_install_dir /home/sbox/sbox-server +login anonymous +app_update 1892930 validate +quitWhen it finishes, the message Success! App '1892930' fully installed. is displayed. If the command stops with an error, run it again: SteamCMD resumes where it left off.
Linking the Steam Client
The server must find steamclient.so to initialize Steamworks. Create the link to the file provided by SteamCMD:
ln -sf /home/sbox/steamcmd/linux64/steamclient.so /home/sbox/.steam/sdk64/steamclient.so
ls -lL /home/sbox/.steam/sdk64/steamclient.soLaunch Script
Create the launch script:
nano ~/start.sh#!/bin/bash
cd /home/sbox/sbox-server || exit 1
exec ./sbox-server \
+game facepunch.sandbox facepunch.flatgrass \
+hostname "My S&box Server" \
+port 27015 \
+net_query_port 27016Make it executable:
chmod 700 ~/start.shMain Parameters
| Parameter | Description |
|---|---|
+game <game> [map] |
Game to load and, optionally, a map. These identifiers are those of the packages published on sbox.game |
+hostname <name> |
Server name shown to players |
+port <port> |
Server port |
+net_query_port <port> |
Information query port |
+net_game_server_token <token> |
Optional: Steam server token, which keeps the same Steam ID from one startup to the next |
Keeping the Same Steam ID (optional)
Without a token, the server gets a new Steam ID on every startup. To keep it:
- Open the Steam game server management page.
- Create a token for application 590830 (S&box).
- Add this line to
start.sh, ending the previous line with\:
+net_game_server_token YOUR_TOKENFirst Launch
Start the server manually to check that it boots, still as the sbox user:
~/start.shThe first startup downloads the game and the map, which can take several minutes. Once the game has loaded, type status in the console to display the server state and the lobby ID. Then type quit to stop it, and exit the sbox user's session:
exitConfiguration as systemd Service
The server console needs a terminal to receive your commands. The service therefore runs the server inside a screen session, which keeps the console accessible and lets you save its output to a file.
Create Service File
sudo nano /etc/systemd/system/sbox.serviceFile content:
[Unit]
Description=S&box Dedicated Server
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=sbox
Group=sbox
WorkingDirectory=/home/sbox
Environment=TERM=xterm
ExecStart=/usr/bin/screen -DmS sbox -L -Logfile /home/sbox/logs/console.log /home/sbox/start.sh
ExecStop=/bin/sh -c '/usr/bin/screen -S sbox -p 0 -X stuff "quit^M"; while kill -0 $MAINPID 2>/dev/null; do sleep 1; done'
Restart=always
RestartSec=20
TimeoutStopSec=60
LimitNOFILE=100000
[Install]
WantedBy=multi-user.targetEnable and Start Service
sudo systemctl daemon-reload
sudo systemctl enable sbox.service
sudo systemctl start sbox.serviceManagement Commands
# Check status
sudo systemctl status sbox.service
# Stop server
sudo systemctl stop sbox.service
# Restart server
sudo systemctl restart sbox.service
# Follow the console output
sudo tail -f /home/sbox/logs/console.logUsing the Server Console
To send a command without opening the console, then read the result:
sudo -u sbox screen -S sbox -p 0 -X stuff "status^M"
sleep 12
sudo tail -n 30 /home/sbox/logs/console.logThe output file is written about every ten seconds, hence the pause.
To open the console live:
sudo -u sbox script -qc "screen -r sbox" /dev/nullTo leave it without stopping the server: Ctrl+A then D.
Connecting to the Server
- Get the lobby ID with the
statuscommand in the server console. - Launch S&box and open the game console.
- Type the following command, replacing the number with your ID, without the
steamid:prefix:
connect 1234567890Administration
These commands are typed in the server console:
| Command | Description |
|---|---|
status |
Shows the server state and the lobby ID |
game <game> [map] |
Loads a game, optionally with a map |
hostname <name> |
Changes the server name |
kick <id> |
Kicks a player, by name or Steam ID |
find <text> |
Searches for a command or a variable |
quit |
Stops the server |
Server Update
The client and the server must remain compatible: update the server as soon as a new version of S&box is released.
sudo systemctl stop sbox.service
sudo -iu sbox /home/sbox/steamcmd/steamcmd.sh +force_install_dir /home/sbox/sbox-server +login anonymous +app_update 1892930 validate +quit
sudo systemctl start sbox.serviceAutomatic Backup
The server folder can be reinstalled at any time with SteamCMD. You only need to keep the launch script and the config and data folders, if they exist.
Backup Script
sudo nano /home/sbox/backup.sh#!/bin/bash
BACKUP_DIR="/home/sbox/backups"
SERVER_DIR="/home/sbox/sbox-server"
DATE=$(date +%Y-%m-%d_%H-%M-%S)
mkdir -p "$BACKUP_DIR"
chmod 700 "$BACKUP_DIR"
# Folders to keep, if they exist
ITEMS=()
for DIR in config data; do
[ -e "$SERVER_DIR/$DIR" ] && ITEMS+=("$DIR")
done
tar -czf "$BACKUP_DIR/sbox_$DATE.tar.gz" -C /home/sbox start.sh -C "$SERVER_DIR" "${ITEMS[@]}"
# Delete backups older than 7 days
find "$BACKUP_DIR" -name "sbox_*.tar.gz" -mtime +7 -delete
echo "Backup completed: sbox_$DATE.tar.gz"sudo chown sbox:sbox /home/sbox/backup.sh
sudo chmod 700 /home/sbox/backup.shSchedule Backup
sudo crontab -u sbox -eAdd:
# Backup every day at 5 am
0 5 * * * /home/sbox/backup.shRegularly copy these archives off the server: a backup kept on the same machine does not protect you from a failure of that machine.
Troubleshooting
GLIBC_2.38 not found or GLIBCXX_3.4.31 not found Error
Your system is too old. The message may also take this form:
Failed to load native library 'libengine2.so'. Error Code: 0/126Reinstall the machine with Debian 13 or Ubuntu 24.04. Replacing only these libraries on Debian 12 or Ubuntu 22.04 risks breaking the system.
libfontconfig.so.1 or Couldn't find a valid ICU package Error
A dependency is missing: run the installation command that matches your system again, in the "Installing Dependencies" section.
steamclient.so Error
Check that the link exists and points to a real file:
sudo -u sbox ls -lL /home/sbox/.steam/sdk64/steamclient.soIf it is missing, recreate it as described in "Linking the Steam Client".
Unable to log on to Steam in a reasonable time!
The server could not connect to Steam in time, and loading the game then fails with Unable to download package. Check the machine's outbound Internet access, then restart the service: the server does not retry this loading on its own.
sudo systemctl restart sbox.serviceCrash at Startup Despite a Compatible System
For example, an X509_INFO_free error on libengine2.so. First update the server, then check the project's reports. If the problem comes from the public version, you can try the staging branch in a separate folder, keeping in mind that not all players may be able to join it:
sudo systemctl stop sbox.service
sudo -iu sbox /home/sbox/steamcmd/steamcmd.sh +force_install_dir /home/sbox/sbox-staging +login anonymous +app_update 1892930 -beta staging validate +quitThen replace /home/sbox/sbox-server with /home/sbox/sbox-staging in start.sh, and restart the service.
Not Connected Message on the Player Side
No lobby was created. Check that the game is loaded with status. If you are developing your own game, its code must create the lobby.
state is 0x202 Error in SteamCMD
There is not enough disk space. Check it with df -h, free up some space, then run the command again.
The console.log File Gets Too Big
Empty it without stopping the server:
sudo truncate -s 0 /home/sbox/logs/console.log