17 launch arguments · 10 players · Valheim 1.0.21
Dedicated server
The server reads 17 arguments. With none it loads the world Dedicated on port 2456, public, keeping 4 auto backups and saving every 30 min. Up to 10 players.
-name "My server" -world "Dedicated" -port 2456 -password "secret1" -crossplayLaunch arguments
| Argument | Default | What it does |
|---|---|---|
-world <name> | Dedicated | The world to load; the server creates it if there is no world by that name. |
-name <name> | the world's name | The server's name in the server list. |
-port <number> | 2456 | The port players connect to; Steam's server list asks the one above it (2457 by default). |
-password <text> | — | Required to join. A public server refuses to start unless it has at least 5 characters and isn't part of the world's name or seed. |
-savedir <folder> | the game's save folder | Where worlds, backups and the admin, ban and permitted lists are kept. |
-public 1 or 0 | 1 | 1 makes the server public; 0 doesn't. Only a public server checks the password rule. |
-logfile <file> | — | The log file; the server notes it in the log. |
-crossplay | — | Runs the server on the crossplay backend (PlayFab) instead of Steam, open to every platform; it gets a 6-digit join code, a new one each start, written to the log. |
-instanceid <id> | — | Stored at start-up; nothing else in the game's code reads it. |
-backups <number> | 4 | How many automatic backups to keep; 0 or 1 turns them off. |
-backupshort <seconds> | 7200 (2 h) | How old the newest backup must be before another is made (at least 5). |
-backuplong <seconds> | 43200 (12 h) | How old the second backup must be before the oldest is dropped; younger, and the newest is replaced instead (at least 5). |
-saveinterval <seconds> | 1800 (30 min) | How often the world saves (at least 5). |
-resetmodifiers | — | Clears the world's modifiers back to normal. |
-preset <preset> | — | Applies a world modifier preset: easy, hard, hardcore, casual, hammer, immersive. |
-modifier <modifier> <option> | — | Sets one modifier: combat veryeasy|easy|default|hard|veryhard; deathpenalty casual|veryeasy|easy|default|hard|hardcore; resources muchless|less|default|more|muchmore|most; raids none|muchless|less|default|more|muchmore; portals casual|default|hard|veryhard. |
-setkey <key> | — | Adds a world key, e.g. nomap or playerdamage 150. |
Difficulty on a server: the same presets and modifiers as the menu — world modifiers.
Ports and joining
Steam
Players connect to 2456 (-port); Steam's server list asks 2457. Forward both, UDP.
By IP
Join Game → Add server → IP:port. An address typed without a port uses 2456.
Crossplay
With -crossplay, players type the 6-digit join code from the server's log; it changes every time the server starts.
Players who can't get in — every message and its cause: connection errors.
Joining a server through a VPN? whoseesmyip.com shows the IP address and country that servers see from your connection.
Admins, bans and the whitelist
Admins
adminlist.txtPlayers who may run admin commands.
Banned
bannedlist.txtChecked every 5 s; anyone on it is kicked.
Permitted
permittedlist.txtIf it lists anyone, every player not on it is kicked.
One player ID per line, in the server's save folder. Press F2 in the game: the panel lists every connected player's ID in the form the lists take. For Steam players the plain Steam ID matches too.
ban | [name/ip/userID] - ban user |
banned | list banned users |
kick | [name/ip/userID] - kick user |
optterrain | optimize old terrain modifications |
save | force saving of world and resets world save interval |
unban | [ip/userID] - unban user |
Cheats: an admin's devcommands goes to the server, and so do these 12, which the server runs for admins only: genloc, listkeys, players, removekey, resetkeys, resetworldkeys, restartparty, setkey, setworldmodifier, setworldpreset, skiptime, sleep. god, fly, spawn and the other cheats run only in a game that is itself the server, so they don't work for a player who joined.
Console commands that work over the network without cheats. All of them: console commands.
Where worlds are saved
Save folder: %USERPROFILE%\AppData\LocalLow\IronGate\Valheim on Windows (Unity's data folder for IronGate/Valheim), or the one -savedir names.
worlds_local— worlds on this computer (worldsfor Steam Cloud saves)characters_local— characters, one.fchfile each- Each world is a folder,
worlds_local/<world>/, holding_main.<n>files (.fwl2, .db2, .chunks, .ok) and.chunkfiles; worlds saved by older versions are<world>.fwl + <world>.db
Moving a world to the server
- On your PC, open
%USERPROFILE%\AppData\LocalLow\IronGate\Valheim\worlds_localand copy the world's folder (named after the world). - Put it in
worlds_localin the server's save folder (or the one -savedir names). - Start the server with
-world "<the world's name>".
The same works the other way, server to PC. A world saved in Steam Cloud isn't in worlds_local; the game's “Move to local” brings it there first.
Auto backups
Backups are named <world>_backup_auto-yyyyMMdd-HHmmss. A dedicated server keeps 4 (the game itself 2). None is made in the first 20 min of a session; after that, at each save:
- nothing, while the newest backup is younger than 2 h (-backupshort);
- otherwise, if the second-newest is younger than 12 h (-backuplong), the newest is replaced;
- otherwise a new one is added, dropping the oldest once there are 4.
So you always keep one recent backup and older ones about 12 h apart.
Questions
What port does a Valheim dedicated server use?
2456 unless -port sets another — players connect to it — and the port above it (2457), which Steam's server list asks for the server's details. Forward both (UDP) for players who join by IP or the Steam list; an IP typed without a port uses 2456.
How do I move my world to a dedicated server?
Copy the world's folder from worlds_local in your save folder to worlds_local in the server's save folder (or -savedir), then start the server with -world and the world's name. Worlds from before 1.0 are two files, <world>.fwl and <world>.db.
Can admins use cheats on a dedicated server?
Only these: an admin's console sends devcommands and genloc, listkeys, players, removekey, resetkeys, resetworldkeys, restartparty, setkey, setworldmodifier, setworldpreset, skiptime, sleep to the server. Other cheats (god, fly, spawn) run only in a game that is itself the server (Terminal.IsCheatsEnabled).
Where is the join code of a crossplay server?
In the server's log: it registers with a 6-digit code, and makes a new one every time it starts. Players type it into Join Game → Add server.
How many players can join a Valheim dedicated server?
10. The server turns the next player away as full.
How do I make someone an admin on my Valheim server?
Put their player ID on its own line in adminlist.txt in the server's save folder (for Steam players the plain Steam ID works). bannedlist.txt bans the same way, and permittedlist.txt, if it has anyone in it, lets only those players in.
How do I set difficulty on a dedicated server?
Start it with -preset (easy, hard, hardcore, casual, hammer, immersive) or -modifier <modifier> <option>, or type setworldpreset / setworldmodifier in the console as an admin while it runs.
Where does a Valheim dedicated server save the world?
In worlds_local inside the save folder (%USERPROFILE%\AppData\LocalLow\IronGate\Valheim on Windows), or in the folder -savedir names.
How often does a Valheim server make backups?
It keeps 4 automatic backups by default, none in the first 20 min of a session. A save makes one once the newest backup is 2 h old; while the second-newest is younger than 12 h it replaces the newest, otherwise it is added and the oldest dropped.
Formula
The argument list, every default and the file names are read from the game's code each patch; the server stops reading a world modifier name it can't parse and logs an error.
FejdStartup.ParseServerArguments, ZNet (player limit, admin/ban/permitted lists), SaveSystem.ConsiderBackup, Game.m_saveInterval — Valheim 1.0.21
