Host a Valheim Server with Backups and Secure Access
To host a Valheim server, install the dedicated-server application, configure your world, and give players a working connection path. Then restrict access and back up the saves to another machine. Finish by restoring a copy and joining it, so you know your recovery process works.
In this Valheim dedicated server guide, we use a Linux service that runs independently of your gaming PC. We separate player permissions from server administration and keep game updates outside the normal startup process.
Our example uses Ubuntu 22.04 LTS on an x86-64 machine, a vanilla world, and an encrypted remote backup repository. Run the procedure on a disposable instance before moving to an established world. Package behavior and game requirements can change, so check the manual bundled with the installed server.
In dieser Anleitung
Check Current Crossplay and Server Requirements
A Valheim dedicated server is an application. It can run on a spare computer, a VPS, oder eine physical dedicated server. Renting an entire machine is one option, not a requirement.
Choose a Hosting Method That Fits Your Group
| Hosting method | Geeignete Verwendung | Work you still own |
|---|---|---|
| Host from the game | Friends who play during the same sessions | Keep the host online and protect local saves |
| Dedicated application on a spare PC | A private group with reliable home power and internet | OS updates, networking, uptime, and backups |
| Self-managed VPS | A separate server with a smaller infrastructure footprint | Game installation, access controls, monitoring, and recovery |
| Physical dedicated server | Several worlds or workloads that need an entire machine | Capacity planning and administration unless management is included |
| Managed Game Hosting | A group that prefers a game panel | Confirm the provider’s backup, restore, update, and support terms |
The server program may be free, but the machine, electricity, internet connection, and backup storage still have costs. Compare the complete monthly cost and the time needed to maintain each option.
Match Player Platforms and Game Versions
Decide whether your group needs Steam-only access or crossplay before changing network rules. Crossplay uses a different connection path, so a Steam-only troubleshooting checklist may send you in the wrong direction.
Iron Gate’s Valheim 1.0 FAQ describes support for 1–10 players and crossplay across its supported platforms. More RAM does not raise the vanilla player limit. The same FAQ states that mods have no official support, so keep this first deployment vanilla.
Check the release notes before each update. Different platform rollout schedules can affect compatibility. Record the client and server versions when a connection fails instead of assuming that the firewall caused it.
Prepare Your Linux Server
Start with these items:
- A clean Ubuntu 22.04 LTS x86-64 instance with systemd.
- A separate administrator account with working sudo and SSH keys.
- A provider console or another recovery path.
- Available disk space for the game, world growth, and temporary recovery copies.
- An off-server SFTP account for backups.
- A maintenance window for stops, restarts, and recovery tests.
For a small vanilla test, we would provision 4 vCPU, 8 GB RAM, and 40 GB of SSD space as a starting budget. This is a planning example, not a measured minimum or a player-capacity promise. Large builds, mods, background processes, and CPU contention can change the result.
Measure memory use, CPU pressure, save size, and player experience during actual sessions. Choose a region near most players and test from their networks. A larger port speed alone will not fix poor routing or an overloaded CPU.
Record the starting environment:
cat /etc/os-release
uname -m
free -h
df -h /srv
systemctl --version Expected checkpoint: the OS and architecture match this procedure, systemd is available, and storage has room for both the active world and a recovery copy.
Install and Run a Service
We use separate locations for game files, saves, and configuration. That makes ownership easier to check and keeps routine updates away from the data we need to recover.
1. Install Dependencies and Create a Game Account
Run these commands from your administrator account:
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository multiverse
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install steamcmd lib32gcc-s1 lib32stdc++6 libatomic1 libpulse0 restic
sudo useradd --system --create-home \
--home-dir /srv/valheim --shell /usr/sbin/nologin valheim
sudo install -d -o valheim -g valheim -m 0750 /srv/valheim/server
sudo install -d -o valheim -g valheim -m 0700 /srv/valheim/saves
sudo install -d -o root -g root -m 0700 /etc/valheim
Review any package license prompts yourself. If the account already exists, inspect it with id valheim rather than recreating it.
Install the dedicated-server application using Steamcmd:
sudo -u valheim -H /usr/games/steamcmd \
+force_install_dir /srv/valheim/server \
+login anonymous +app_update 896660 +quit
sudo -u valheim test -x /srv/valheim/server/valheim_server.x86_64 Expected checkpoint: SteamCMD finishes the installation and the executable check returns without an error. If installation fails, resolve it before creating the service. Do not continue with a partially downloaded server.
2. Configure the World and Startup Settings
Create a configuration file with sudoedit /etc/valheim/server.env:
SERVER_NAME="Private Viking Server"
WORLD_NAME="VikingWorld"
SERVER_PASSWORD="REPLACE_WITH_A_LONG_RANDOM_PASSWORD"
SERVER_PORT=2456
SERVER_PUBLIC=0
SERVER_CROSSPLAY=0 Replace the password before starting. Use a long random value that does not contain the world or server name. Keep the example’s configuration syntax simple; avoid quotes or line breaks inside the value.
Set SERVER_CROSSPLAY=1 when your group needs crossplay. SERVER_PUBLIC=0 hides the listing; it does not replace authentication or a permitted-player list.
Schaffen /usr/local/bin/valheim-start mit sudoedit:
#!/usr/bin/env bash
set -euo pipefail
: "${SERVER_NAME:?Missing server name}"
: "${WORLD_NAME:?Missing world name}"
: "${SERVER_PASSWORD:?Missing password}"
if [[ "$SERVER_PASSWORD" == REPLACE_* ]]; then
echo "Set a real server password before starting." >&2
exit 1
fi
cd /srv/valheim/server
export SteamAppId=892970
export LD_LIBRARY_PATH="/srv/valheim/server/linux64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
args=(
-nographics -batchmode
-name "$SERVER_NAME"
-world "$WORLD_NAME"
-password "$SERVER_PASSWORD"
-port "${SERVER_PORT:-2456}"
-public "${SERVER_PUBLIC:-0}"
-savedir /srv/valheim/saves
)
if [[ "${SERVER_CROSSPLAY:-0}" == "1" ]]; then
args+=(-crossplay)
fi
exec ./valheim_server.x86_64 "${args[@]}" Then set file permissions:
sudo chmod 0600 /etc/valheim/server.env
sudo chown root:root /usr/local/bin/valheim-start
sudo chmod 0755 /usr/local/bin/valheim-start
sudo bash -n /usr/local/bin/valheim-start
This launcher uses exec so the game becomes the service’s main process. Keep the current bundled startup script for comparison after updates, especially if its library settings change.
The environment file protects the password on disk. The game still receives it as an argument, so do not treat this as isolation from other local users or the host administrator. Redact process listings and service output before sharing them.
3. Start Valheim Through systemd
Schaffen /etc/systemd/system/valheim.service:
[Unit]
Description=Valheim dedicated server
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=valheim
Group=valheim
WorkingDirectory=/srv/valheim/server
EnvironmentFile=/etc/valheim/server.env
ExecStart=/usr/local/bin/valheim-start
Restart=on-failure
RestartSec=15
KillSignal=SIGINT
TimeoutStopSec=180
UMask=0077
NoNewPrivileges=true
PrivateTmp=true
[Install]
WantedBy=multi-user.target Überprüfen und starten Sie es:
sudo systemd-analyze verify /etc/systemd/system/valheim.service
sudo systemctl daemon-reload
sudo systemctl enable --now valheim
sudo systemctl is-active valheim
sudo journalctl -u valheim -n 80 --no-pager Expected checkpoint: the service stays active and the logs reach the game’s ready state. A running process alone does not prove that players can connect.
The service requests SIGINT during shutdown. The systemd termination documentation explains that a process can receive a forced termination after the stop timeout. Our 180-second limit is an example allowance, not proof that every world will save within that time.
Test a clean stop:
sudo systemctl stop valheim
sudo systemctl show valheim -p ActiveState -p Result
sudo journalctl -u valheim -n 50 --no-pager Proceed only after the process exits and the logs show no save failure or timeout. Then start it again:
sudo systemctl start valheim 4. Move an Existing World Carefully
Stop the source world and keep an unchanged copy. If the save is cloud-managed, use the game’s save-management controls to obtain a local copy before moving it.
Inspect the destination structure:
sudo find /srv/valheim/saves -maxdepth 3 -type d
Stop the destination service with sudo systemctl stop valheim before transferring files. Copy the complete selected world into the corresponding save location and match WORLD_NAME to it. Preserve related files and folders. Iron Gate documents a save-format change in its 1.0.15 patch notes, so an old instruction to copy only .db und .fwl files is not a safe rule for every build.
After transferring the save:
sudo chown -R valheim:valheim /srv/valheim/saves
sudo systemctl start valheim Join and check an existing structure. A new empty world usually calls for checking the world name and save path before changing hardware or network settings.
Control Firewall and Admin Access
We need two separate controls: a path for approved players to reach the game and restricted access to the operating system.
Use the Correct Network Path
Die official dedicated-server manual distinguishes these routes:
| Backend | Connection behavior | Überprüfen Sie zuerst |
|---|---|---|
| Steam | Default game range is UDP 2456–2457 | Host/provider firewall; router forwarding if behind NAT |
| Crossplay | Uses a relay and does not require router forwarding | Outbound connectivity and current join details |
Crossplay connections do not use a local or loopback address. Use the supported public connection method or join code. Recheck the current bundled manual if you change ports or run multiple instances.
On a new server, inspect existing rules before making changes:
sudo ufw status verbose
sudo ss -lntp
sudo ss -lunp If you use UFW, add an SSH rule for your actual administrator IP and configured SSH port before enabling it. The values below are placeholders:
sudo ufw allow from ADMIN_PUBLIC_IP to any port SSH_PORT proto tcp For the Steam route on the example ports:
sudo ufw allow 2456:2457/udp Keep your current session open, confirm console access, and review all required services before running:
sudo ufw enable
sudo ufw status numbered Open a second SSH session to prove that access still works. Apply matching rules in the provider firewall. A home-hosted Steam server also needs router rules that point to the correct local machine. Carrier-grade NAT may prevent direct inbound connections.
For crossplay, keep the firewall in place. Relay use is not a reason to disable it. If outbound traffic is restricted, check the current relay requirements with your network administrator.
Separate Players, Game Admins, and Linux Admins
The official manual uses three files in the save path: permittedlist.txt, adminlist.txtund bannedlist.txt. Entries use case-sensitive platform user IDs. A nonempty permitted list excludes players who are not listed.
For a private group, stop the service and edit the permitted and admin lists:
sudo systemctl stop valheim
sudo -u valheim touch /srv/valheim/saves/permittedlist.txt
sudo -u valheim touch /srv/valheim/saves/adminlist.txt
sudoedit /srv/valheim/saves/permittedlist.txt
sudoedit /srv/valheim/saves/adminlist.txt
sudo chown valheim:valheim /srv/valheim/saves/*list.txt
sudo chmod 0600 /srv/valheim/saves/*list.txt
sudo systemctl start valheim Get the exact IDs from the game or its logs. Include your own player ID in the permitted list. Give game-admin rights only to people who need them; ordinary players do not need SSH access.
Before removing any SSH login method, prove that key-based login and the recovery console work. Changing the SSH port is not a substitute for authentication.
Test Connections From Outside the Server Network
Use this checklist:
- An approved player can enter the intended world.
- An incorrect password fails.
- A player outside the permitted list cannot enter.
- An ordinary player does not receive admin rights.
- The world remains available after the administrator closes SSH.
- Each platform you claim to support passes a real join test.
A TCP port-checking website cannot prove that UDP gameplay works.
| Symptom | Evidence to inspect | Nächster Schritt |
|---|---|---|
| Service exits repeatedly | Journal and install log | Resolve dependencies, paths, or configuration |
| Process runs but friends cannot join | Backend, client/server versions, firewall | Test the actual connection route |
| Server is missing from the public list | Listing setting | Use direct connection if intentionally hidden |
| Players enter a blank world | World name and save directory | Correct the selected world; keep the original copy |
| One player is rejected | Password, platform ID, access lists | Check the exact entry and client version |
| Lag grows near a large base | CPU, memory, network, client behavior | Measure before increasing server size |
Restore a World After an Update
A backup protects the world only if we can retrieve it and resume play. A file on the same server does not cover loss of that server.
Create an Encrypted Off-Server Repository
This example uses restic over SFTP. Prepare a separate backup account, a writable remote directory, and key-based SFTP access. The automated job runs as root, so test that connection under the same account. Verify the remote host key through a trusted source; do not disable host-key checks.
Create a root-only backup configuration directory:
sudo install -d -m 0700 /etc/valheim-backup
sudoedit /etc/valheim-backup/password
sudo chmod 0600 /etc/valheim-backup/password
sudoedit /etc/valheim-backup/restic.env Put a new repository password in the password file. In restic.env, set your actual remote destination:
RESTIC_REPOSITORY='sftp:[email protected]:/srv/backups/valheim'
RESTIC_PASSWORD_FILE='/etc/valheim-backup/password' Keep a separate secure copy of the repository password and recovery credentials. Losing them can make the backups unusable. Ordinary SFTP write access may also allow deletion; ask the storage operator for independent snapshots or another retention control if you need protection from a compromised source server.
Initialize the repository once:
sudo chmod 0600 /etc/valheim-backup/restic.env
sudo bash -c 'set -a; source /etc/valheim-backup/restic.env; set +a; restic init' Expected checkpoint: restic creates the remote repository. For an existing repository, use restic snapshots instead of initializing it again.
Back Up Only After a Clean Stop
Our simple procedure pauses gameplay during the backup transfer. Tell players beforehand. Larger worlds or slow remote storage will need a longer window; measure the duration before scheduling it.
Schaffen /usr/local/sbin/valheim-backup:
#!/usr/bin/env bash
set -euo pipefail
umask 077
exec 9>/run/lock/valheim-maintenance.lock
flock -n 9 || { echo "Maintenance already running" >&2; exit 1; }
set -a
source /etc/valheim-backup/restic.env
set +a
# Confirm remote access before interrupting players.
restic snapshots >/dev/null
was_running=0
if systemctl is-active --quiet valheim; then
was_running=1
fi
resume() {
status=$?
trap - EXIT
if (( was_running )); then
systemctl start valheim || status=1
fi
exit "$status"
}
trap resume EXIT
systemctl stop valheim
state=$(systemctl show valheim -p ActiveState --value)
result=$(systemctl show valheim -p Result --value)
[[ "$state" == inactive && "$result" == success ]] || {
echo "Clean stop not confirmed; backup cancelled" >&2
exit 1
}
[[ -n "$(find /srv/valheim/saves -type f -print -quit)" ]] || {
echo "Save directory is empty; backup cancelled" >&2
exit 1
}
restic backup --tag valheim \
/srv/valheim/saves \
/etc/valheim \
/etc/systemd/system/valheim.service \
/usr/local/bin/valheim-start Set permissions and run the first backup during maintenance:
sudo chmod 0700 /usr/local/sbin/valheim-backup
sudo bash -n /usr/local/sbin/valheim-backup
sudo /usr/local/sbin/valheim-backup
sudo systemctl is-active valheim The script rejects an empty save directory and an unsuccessful service stop. Those checks do not prove that the expected world exists or that the game saved correctly. Inspect the game logs and repository contents, then perform the restore exercise below.
The backup includes the entire chosen save directory and configuration. It excludes the game binaries and the repository credentials. Keep build records and recovery credentials separately. See restic’s backup documentation for snapshot behavior and error reporting.
Schedule Backups and Watch for Failures
After a successful manual run and restore rehearsal, create /etc/systemd/system/valheim-backup.service:
[Unit]
Description=Back up Valheim saves and configuration
[Service]
Type=oneshot
ExecStart=/usr/local/sbin/valheim-backup
TimeoutStartSec=infinity Schaffen /etc/systemd/system/valheim-backup.timer:
[Unit]
Description=Daily Valheim backup schedule
[Timer]
OnCalendar=*-*-* 04:00:00
Persistent=false
Unit=valheim-backup.service
[Install]
WantedBy=timers.target
This example uses the server’s timezone. Persistent=false avoids an unexpected catch-up stop after boot, but a missed run stays missed.
sudo systemctl daemon-reload
sudo systemctl enable --now valheim-backup.timer
sudo systemctl list-timers valheim-backup.timer
sudo journalctl -u valheim-backup.service -n 50 --no-pager Connect your monitoring system to failed jobs and the age of the latest successful backup. A log entry alone does not notify anyone. Also monitor jobs that run longer than the maintenance window and confirm that the game returns to a joinable state afterward.
Daily backups can leave nearly a day of progress at risk. If the group accepts only two hours of lost progress, choose a shorter interval and account for the extra stops, or design a tested staging-copy process that reduces downtime.
For retention, preview a policy before removing anything:
sudo bash -c 'set -a; source /etc/valheim-backup/restic.env; set +a; restic forget --tag valheim --keep-daily 7 --keep-weekly 4 --keep-monthly 3 --dry-run' This is an example policy. Review which snapshots it would remove, keep known-good pre-update copies, and confirm recovery before applying deletion. Schedule storage cleanup separately from backup jobs. Refer to restic’s retention documentation.
Rehearse Recovery Without Overwriting the Live World
List snapshots, select the intended date, and replace SNAPSHOT_ID below:
sudo bash -c 'set -a; source /etc/valheim-backup/restic.env; set +a; restic snapshots --tag valheim'
sudo install -d -m 0700 /srv/valheim-restore
sudo bash -c 'set -a; source /etc/valheim-backup/restic.env; set +a; restic restore SNAPSHOT_ID --target /srv/valheim-restore'
Use a fresh restore directory for each attempt. The original absolute paths appear beneath that target, so the saves should be under /srv/valheim-restore/srv/valheim/saves. Inspect them before use. Restic documents this path behavior in its restore guide.
On a second disposable instance, install the compatible server build and configure the same world name. Copy the restored saves into its save directory, correct ownership, start it, and join. Do not automatically replace live access lists or passwords with older copies.
A practical exercise: create a sign labeled “Backup Check” and record a chest’s contents. Back up the world, then change the sign. Restore the earlier snapshot on the test instance and check that the old sign and recorded contents return. This is an example exercise, not a reported Atal Networks customer result.
Record the snapshot ID, versions, successful join, expected world state, and elapsed time. Recovery time ends when players can use the correct world, not when files finish downloading.
Recover the Live World and Handle Updates
During an agreed recovery window, pause the backup timer and obtain the same maintenance lock before stopping the game. Preserve the current save directory rather than deleting it. Copy the inspected restored saves into a new active directory, correct ownership, and confirm the configured world name.
Start the service and join before reopening access. If the restore fails, stop again and return the preserved directory to its original path. Resume the timer only after the selected world works.
For routine updates, follow this sequence:
- Read release notes and check client compatibility.
- Announce the window and run a successful backup.
- Pause the backup timer and wait for any running backup job to finish.
- Hold the maintenance lock, stop the server, and record the installed build.
- Run the installation command again to obtain the intended update.
- Start, join, and inspect the world before resuming backups.
Use a root maintenance shell to hold the lock while carrying out those tasks:
sudo -i
exec 9>/run/lock/valheim-maintenance.lock
flock -n 9 If the lock command fails, exit that shell and wait. Run maintenance only after it succeeds; exit the shell when finished to release the lock. Do not run the backup script from this locked shell, because it needs the same lock.
Restoring a world and downgrading the server are different operations. A newer save format may not work with an older executable. Keep pre-update saves and build records, and follow version-specific guidance rather than attempting an unsupported downgrade. The backup procedure above does not preserve old executables; it cannot guarantee a binary rollback.
Valheim Server Questions
Can I Host a Valheim Server Without Leaving My Gaming PC On?
Does Valheim Require a Physical Dedicated Server?
Can Steam and Console Players Share a World?
Can I Hide the Server and Still Invite Friends?
Does a World Backup Include Every Player’s Character?
Can I Restore After an Update?
Is More RAM the First Fix for Lag?
Are Local Automatic Backups Enough?
Final Setup and Recovery Checklist
Before calling the server ready, confirm:
- The game runs under its own account.
- Approved players can join from outside the server network.
- Password and permitted-player checks reject unwanted access.
- SSH and recovery-console access work.
- Clean stops and reboots preserve the correct world.
- Backups reach another machine and failed jobs get attention.
- A restored copy accepts players and contains the expected progress.
- Someone owns game updates, OS patches, access reviews, and recovery tests.
Atal Networks can discuss infrastructure based on your player regions, world size, mods, and recovery needs. Compare our Dedizierte Spielserveroptionen after you define those requirements. Confirm management and backup responsibilities in the selected service terms.
Ready to Deploy Your Valheim World?
Explore bare metal servers, high-frequency VPS options, and DDoS-mitigated routing built for persistent multiplayer communities.
