Direct answer
From the dedicated server console, run:
op YourPlayerNameTo remove operator access later:
deop YourPlayerNameConsole commands do not need a leading slash.
What OP gives you
Operator status grants access to powerful server commands. On a small private server, OP is convenient for the owner. On a larger server, give staff only the permissions they actually need through a permissions system instead of making everyone an operator.
If op is “unknown” in game
A player who is not already permitted to manage operators cannot usually grant themselves OP from chat. Use the server console or your hosting panel's console. Once you are OP, reconnect if a plugin or permission cache requires it.
Do not edit ops.json unless you need to
The command is safer than hand-editing ops.json because the server handles the player's identity and file format. Manual edits are mainly useful for recovery or automation, not normal setup.
For plugin servers
Permissions plugins such as LuckPerms can grant specific commands without giving a staff member every operator capability. This becomes increasingly important as a public server grows.
Official references
These references were checked while preparing this guide. Version-specific behavior can change, so use the project documentation for your exact release when a detail differs.
Related guides
Help us improve this article
Tell us what is missing, unclear, outdated, or incorrect. You can also suggest something we should add.