> For the complete documentation index, see [llms.txt](https://docs.aethercube.fr/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aethercube.fr/developers/running-a-server/whitelist-and-bans.md). Agents can also search and read this documentation through its [MCP server](https://docs.aethercube.fr/~gitbook/mcp).

# Whitelist and bans

This page is for server owners who want to control who gets in. A server decides that with three lists: a whitelist, a list of banned accounts and a list of banned IP addresses. They are kept in the data directory (`storage.data_directory`), survive a restart, and are changed with commands from the console or in game, or by a plugin (see [Gameplay registries](https://docs.aethercube.fr/developers/plugins/gameplay-registries.md#access-control)). The wire side is described in [Contracts](https://docs.aethercube.fr/developers/protocol/contracts.md).

## Who may join

When a player has authenticated, the server runs these checks, in this order, and refuses at the first that fails:

1. **Account ban.** The player's account (their UUID) is banned.
2. **Address ban.** The address of the connection is banned.
3. **Whitelist.** The whitelist is on and the player is not on it.

Operators are not exempt from any of them. An operator who must be able to join a whitelisted server is added to the whitelist like anyone else.

A ban whose end has passed no longer applies. It is removed at the next check.

### What the player sees

| Situation                                                      | Wire message                                        | Text the player gets                                                                           |
| -------------------------------------------------------------- | --------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| Joining while banned (account or address)                      | `ConnectionRejected`, reason `PLAYER_BANNED` (7)    | "You are banned from this server.", followed by the server's text.                             |
| Joining while the whitelist is on and not listed               | `ConnectionRejected`, reason `NOT_WHITELISTED` (11) | "You are not on this server's whitelist.", followed by the server's text, which says the same. |
| Banned, or removed from an enforced whitelist, while connected | `DisconnectNotice`, reason `BANNED` (7)             | "You were banned from this server.", followed by the server's text.                            |

The server's text for a ban is `banned: <reason>` for a permanent ban and `banned until 2026-12-24 18:00 UTC: <reason>` for a temporary one. The reason is left out when there is none. The time is in UTC and rounded up to the minute, so a player who tries again at the time shown is let in. The text is at most 256 characters, control characters are replaced by spaces. The refusal has `retry_allowed` set to false, and the disconnect has `reconnect_allowed` set to false.

Banning a connected player, banning an address that a connected player uses, turning the whitelist on, or removing a connected player from it disconnects the players concerned at once.

## The files

The three files are in `storage.data_directory` (default `server-data/`). The server writes them after every change, through a temporary file that is renamed over the old one. The server reads them only at start-up: while it runs, change the lists with the commands, because the server overwrites the files at the next change.

All three are JSON objects with `"format_version": 1` and a list `"entries"`. A missing file is an empty list. A missing optional field takes its default.

### `whitelist.json`

```json
{
  "format_version": 1,
  "enforced": true,
  "entries": [
    {
      "name": "Alice",
      "uuid": "5f0c4c6e-2f3a-4b4e-9d57-1d3b7f0a9c11",
      "added_by": "console",
      "added_at": "2026-12-04T10:00:00Z"
    }
  ]
}
```

| Field      | Meaning                                                                                             |
| ---------- | --------------------------------------------------------------------------------------------------- |
| `enforced` | Whether the whitelist is on. When it is off, the entries are kept but not applied. Default `false`. |
| `name`     | Required. The player's name as it was added.                                                        |
| `uuid`     | The account UUID, or `null` when the player has never been seen.                                    |
| `added_by` | `console` or the name of the operator. Default `console`.                                           |
| `added_at` | An ISO-8601 UTC instant.                                                                            |

### `bans.json`

```json
{
  "format_version": 1,
  "entries": [
    {
      "name": "Troll",
      "uuid": null,
      "reason": "griefing",
      "source": "console",
      "created": "2026-12-04T10:00:00Z",
      "expires": "2026-12-11T10:00:00Z"
    }
  ]
}
```

| Field     | Meaning                                      |
| --------- | -------------------------------------------- |
| `name`    | Required.                                    |
| `uuid`    | The account UUID, or `null`.                 |
| `reason`  | Shown to the player. Default empty.          |
| `source`  | Who banned. Default `console`.               |
| `created` | When the ban was made.                       |
| `expires` | When it ends, or `null` for a permanent ban. |

### `ip-bans.json`

Same fields as `bans.json`, with `address` instead of `name` and `uuid`. The `address` is an IPv4 or IPv6 literal. It is stored in its canonical text form.

An IPv4 address is banned exactly. An IPv6 address bans the **whole /64 network** it belongs to: a subscriber is usually given a whole /64, so a ban on one address would be dodged by rotating inside it. The file keeps the address you gave. `/ban-ip` says so in its reply, for example `The ban covers the whole network 2001:db8:1:2::/64.`, and `/pardon-ip` of any address of that network lifts the ban.

### How a player is matched

* An account is matched by UUID. An entry that has a name but no UUID, because the player had never been seen, matches the name without regard to case. It takes the UUID of the first matching player who is checked, and follows the account from then on.
* When you ban or whitelist a name, the server looks for the UUID among the players who are online and the players who have a saved profile or joined since the start. In offline mode the UUID of a player is the part after `offline:` in their player id.
* An address is matched by its IP literal. A host name is never resolved. An IPv4 address is matched exactly, an IPv6 address by its /64 network.

### A damaged file

A file that exists but cannot be read in full is an error, never an empty list. If a ban list that failed to load silently turned into an empty one, it would let every banned player back in, and I do not want that to happen quietly. So the server refuses to start and names the file. This covers a JSON syntax error, a root that is not an object, a missing or non-list `entries`, an entry without a name, a bad UUID, address or date, and a `format_version` other than `1`.

Fix the file, or move it away to start with an empty list.

## Commands

All of them are for operators by default, through the node `server.command.<name>` (see [Operators and permissions](https://docs.aethercube.fr/developers/running-a-server/operators-and-permissions.md)). The console may use them all. Player names are compared without regard to case.

| Command                                          | Node                       | Effect                                                                                                                                              |
| ------------------------------------------------ | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `/whitelist on`                                  | `server.command.whitelist` | Turn the whitelist on. Connected players who are not on it are disconnected.                                                                        |
| `/whitelist off`                                 | `server.command.whitelist` | Turn it off. The entries stay.                                                                                                                      |
| `/whitelist add <name>`                          | `server.command.whitelist` | Add a player.                                                                                                                                       |
| `/whitelist remove <name>`                       | `server.command.whitelist` | Remove a player. A connected player who is no longer allowed is disconnected when the whitelist is on.                                              |
| `/whitelist list`                                | `server.command.whitelist` | Show whether it is on, and the names.                                                                                                               |
| `/ban <name> [duration] [reason...]`             | `server.command.ban`       | Ban an account. Replaces an earlier ban of it.                                                                                                      |
| `/ban-ip <address\|name> [duration] [reason...]` | `server.command.ban-ip`    | Ban an IP address. With the name of a connected player, bans the address that player is connected from. An IPv6 address bans its whole /64 network. |
| `/pardon <name>`                                 | `server.command.pardon`    | Lift an account ban.                                                                                                                                |
| `/pardon-ip <address>`                           | `server.command.pardon-ip` | Lift an address ban. Only an IP literal is accepted. Any address of a banned IPv6 /64 network lifts the whole ban.                                  |
| `/banlist [players\|ips]`                        | `server.command.banlist`   | List the bans: the accounts, the addresses, or both.                                                                                                |

Turning the whitelist on or off when it is already in that state is an error, not a change.

### Durations

The optional duration comes right after the name or address.

* A number of 1 to 5 digits and a unit: `m` (minutes), `h` (hours), `d` (days) or `w` (weeks), for example `30m`, `12h`, `7d`, `2w`.
* Zero is refused, and so is anything longer than 3650 days (ten years).
* Without a duration the ban is permanent.
* The first word after the name is read as a duration when it has this shape. Anything else starts the reason.

```
/ban Troll 7d griefing the spawn
/ban Spammer repeated advertising
/ban-ip 203.0.113.9 2w
/ban-ip Troll 1d
/pardon Troll
/banlist ips
```

A player cannot ban themselves with `/ban`.

## Offline and online servers

In online mode a player is an account, and the bans follow the account when the player renames it. In offline mode the identity comes from the name, so a banned name is refused under any address, and a banned player can come back with another name. Use an address ban in addition, knowing that addresses are shared.

## Backups

The three files are part of every complete backup. See [Worlds, saves and backups](https://docs.aethercube.fr/developers/running-a-server/worlds-saves-and-backups.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.aethercube.fr/developers/running-a-server/whitelist-and-bans.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
