You need to be on the admin list yourself before you can ban anyone. See How to Become Admin first if you haven't set that up yet.
Method 1: the admin command
- In-game, press F5 to open the console.
- Type
ban <playername>and press Enter.
This takes effect immediately, no restart needed. To see everyone currently banned, type banned.
Method 2: editing the file directly
Useful if the player isn't online to ban live, or you want to ban a Steam ID you already have on hand.
- Open Files.
- Navigate to
.config/unity3d/IronGate/Valheim/bannedlist.txt. - Right click and choose Edit.
- Add the player's SteamID64 on its own line.
- Save and close.
- Restart the server.
Unbanning someone
In-game, type unban <name/id/ip> in the console. Or open bannedlist.txt, delete their line, save, and restart.
Still stuck?
If a banned player can still connect, confirm you restarted the server after editing the file, bannedlist.txt only reloads on startup. If you banned by name and it didn't take, try their SteamID64 instead, names can be spoofed but Steam IDs can't.
Did this solve it?
If you are still stuck, our team can look at your server directly.