How to whitelist, op and ban players on a Minecraft server
These commands work on a standard Java Edition server. Run them from the server console, or in game as an operator (with a leading slash).
The whitelist
With the whitelist on, only listed players can join. Everyone else sees “You are not white-listed on this server”.
whitelist onandwhitelist offturn it on and off.whitelist add Nameandwhitelist remove Namechange the list.whitelist listshows who is on it.whitelist reloadre-reads the file if you edited it by hand.
To start with the whitelist enabled, set white-list=true in server.properties. Set enforce-whitelist=true too if you want players already online to be removed when they are taken off the list. The list is stored in whitelist.json in the server folder.
Operators
op Name makes someone an operator, deop Name removes it. Operators can use commands, so give it only to people you trust with the world. They are stored in ops.json.
Operators have a level from 1 to 4. Roughly: level 1 bypasses spawn protection, level 2 can use most gameplay commands (including command blocks), level 3 can manage players (ban, kick, op), and level 4 can run everything including stopping the server. The default for new operators is set by op-permission-level in server.properties, and its default is 4.
Bans and kicks
kick Name [reason]removes someone for now.ban Name [reason]bans an account.pardon Namelifts it.ban-ip addressbans an IP address, andpardon-ip addresslifts it.banlist playersorbanlist ipsshows the lists.
Bans are stored in banned-players.json and banned-ips.json. An IP ban also affects anyone else on the same connection, so use it only when you have to.
The names-and-IDs trap
A server in online mode checks accounts with Mojang and tracks players by a permanent ID, so renaming an account does not lose its status. A server in offline mode trusts whatever name the client sends, which means anyone can join as anyone, including as an operator. Do not run offline mode on a public server, and if you do for testing, keep the whitelist on.
Small things that help
- Names are case-insensitive in commands but must be spelled exactly, so copy them.
- If a name will not add, the player may not exist, or the server cannot reach Mojang’s servers.
- Edit the JSON files only when the server is stopped, then start it again.
If you would rather not run a server
On JetRift, the Players tab handles the whitelist, operators and bans with buttons and player heads, and changes you make in game show up there too. JetRift is a free Minecraft Java host we run: you make a server, send friends the address, and it starts when the first person joins. It is early, Java only, and has no mods. It is the same underlying server commands, without the files.
More guides
Fix “Failed to connect to the server” · “Can’t keep up! Is the server overloaded?” · Move a world to a new host · Free ways to host a server