Skip to content

Admin Commands

JonathanLA edited this page Nov 11, 2026 · 1 revision

Admin Commands

ServerGuard exposes a sg command family in the in-game console (F5). Anyone can type the command, but the server only executes for SteamIDs listed in moderators.yaml.

Setup

Add your SteamID to BepInEx/config/ServerGuard/conf/moderators.yaml:

moderators:
  - 76561198064360681

Save — the server hot-reloads. From now on, sg commands typed in your console reply only to you (other players never see the output).

Usage

Press F5 to open the console. Type:

sg help

You'll get back a list of every available command.

Command reference

General

Command What it does
sg help Print this command list.
sg status Quick health check — enforcement state, allowlist counts, modset fingerprint, peer count, violators on file.
sg selftest Re-run the boot smoke tests.
sg reload Re-read every conf/*.yaml from disk: settings, owners, moderators, bans, allowed_mods, registrations, violations, progress.
sg modset Print the full + short modset fingerprints for sharing.

Players

Command What it does
sg whois <steamid|name> Show player info: registered character names, online status, admin status, per-rule violations. Accepts SteamID literal or character-name substring.
sg violations [<n>] Top N players by violation count (default 10).
sg pardon <steamid> Clear a player's recorded violation strikes.
sg unregister <steamid> [character] Forget one registered character name, or all of them when no name is given, so the player can register fresh ones.
sg kick <steamid> [reason] Kick a connected player. The reason is shown to them on the disconnect screen.

Personal progression

Command What it does
sg progress Status of personal progression and the world's bosses.
sg progress <player> A character's progress and start-temple altars.
sg progress grant|revoke <player> <boss|key|all> Give or take away a boss / progress key.
sg progress altar <player> <boss> [on|off] Light or clear a start-temple altar.
sg progress reset <player> Clear a character's progress.
sg seal List sealed accounts (inventory seal, 2.2).
sg seal show <steamid> The inventory each of the account's characters last had here.
sg seal add <steamid> [hours] [reason] Seal an account: on every join its characters lose items brought from other worlds. No hours = until unsealed.
sg seal remove <steamid> / sg seal clear Unseal one account / all.
sg watch Watch page status and address (2.3). See Watch Page.
sg watch key [label] Create your personal watch-page key. Shown once and copied to your clipboard.
sg watch keys / sg watch revoke <id|all> List keys (owners: everyone's) / cancel keys.
sg whitelist Whitelist mode and counts (2.4). See Whitelist.
sg whitelist add <steamid|name> [note] / remove <steamid|name> Let a player in (approves their join request) / take them off.
sg whitelist list [filter] / requests The list / the waiting join requests.
sg whitelist deny <steamid|name|all> Dismiss join request(s).
sg whitelist import Add everyone who has played here before (from registrations.yaml).
sg test api Test helper (2.2): API state, ProgressCredited subscribers, seal state and account keys of everyone online, webhooks set or not.
sg test kill [<player>] <boss|key> Credit a kill as if <player> (default: you) landed it: ledger, personal keys, API event, Discord posts and the world key, through the same code as a real kill.
sg test reset <pattern...> [altars] [confirm] ServerGuardApi.ResetProgress on every character, e.g. sg test reset defeated_* biomelords_defeated_* altars confirm (Blót's Ragnarök call). Without confirm it only counts what would go. World keys are untouched.
sg test listen [on|off] Post every ProgressCredited API event to the admin channel (until restart).
sg test discord [public|admin|both] [text] Post through ServerGuardApi.PostDiscord.
sg test raid [<event> [<player>] | stop] List raids, start one on a player (default: you), or stop it. Exercises the raid Discord posts.
sg test join <steamid> [character] Run the whitelist check as if that player tried to join (2.4). Records a join request like a real attempt.

<player> = character name, SteamID, or steamid:name. See Personal Progression.

Bans

Command What it does
sg ban <steamid> [for <N>d|h|m] [reason] Ban a SteamID. Blocked during the connection handshake, so they never reach the world.
sg unban <steamid> Lift a ServerGuard ban.
sg bans [<n>] List active bans (default 20).

Notes:

  • The target does not have to be online, or ever to have connected. Pass a full 17-digit SteamID to ban someone pre-emptively. Character-name lookup only works for players the server has already registered.
  • Duration forms: 7d, 12h, 30m, 45s. A bare number means days. Leave it off for a permanent ban. Expired bans stop applying automatically and are cleaned out of the file on the next write.
  • Banning yourself, an owner, or a moderator is refused. Owners cannot be banned at all; to ban a moderator, remove them from moderators.yaml first. See Privilege Tiers.
  • A ban applies immediately to anyone already in the world — they are disconnected as soon as the command runs.
  • sg unban clears ServerGuard's list. If banLayerMirrorToVanilla is on (the default) the entry in Valheim's own banlist.txt remains; clear that with the vanilla unban command if you want it gone. Conversely, the in-game unban command cannot lift a ServerGuard ban.
sg ban 76561198000000000 for 7d griefing spawn area
sg ban 76561198000000000 duping
sg unban 76561198000000000
sg bans 50

Build / destroy heatmap queries

Command What it does
sg build at <x> <z> [radius=50] [days=7] All build events near coords.
sg build by <steamid|name> [days=7] All build events by a player.
sg build today [<n>] Last N build events today (default 10).
sg destroyed at <x> <z> [radius] [days] Same as build at but only destroy events.
sg destroyed by <name> [days] Same as build by but only destroy events.
sg destroyed today [<n>] Last N destroys today.
sg placed at | by | today … Mirrors destroyed but for placements only.

For destroy queries, <name> can be a creature name like Troll or Bonemass — creature destructions are tracked the same way as player destructions.

Examples

> sg status
[ServerGuard] v1.4.0  enforce=True  requireCompanion=True  requireHmac=True
  Allowlist  required=1  allowed=29  banned=0
  Modset     loose=8ce8906e  strict=19815033
  Online     3 peer(s)
  Violators  2 player(s) with strikes recorded

> sg whois Erik
  Erik (76561198064360681)
      DevcommandAttempt              2/3
      SpeedHack                      1/3 (informational)
      online=yes  admin=no

> sg destroyed by Troll 7
[ServerGuard] 1 destroy(s) by `Troll` in last 7d:
  14:21:42  DESTROY  Troll               wood_floor              (-1232.8, 565.2)

> sg destroyed at -1230 565 30
[ServerGuard] 3 destroy(s) within 30m of (-1230, 565) in last 7d:
  14:22:18  DESTROY  Loki                wood_wall_log           (-1230.5, 565.2)
  14:21:42  DESTROY  Troll               wood_floor              (-1232.8, 565.2)
  10:15:00  DESTROY                      stone_wall              (-1228.0, 567.5)

Audit trail

Mutating commands (reload, pardon, kick, progress grant/revoke/altar/reset, seal add/remove/clear, test kill/reset/raid) are posted to the admin Discord channel as 🛠 <admin> ran sg <command>. Read-only queries (status, whois, build …) are not — they happen too often during investigations.

Trust + security

Anyone can type sg ... in the console. The intercept always swallows the input so it's never broadcast as chat. The server validates IsAdmin(steamId) before executing — non-admins get a one-line "you are not an admin" reply.

The chat intercept also accepts /sg ... (with leading slash). Either form works.

See also

Clone this wiki locally