How to Manage ACE Permissions on FiveM
Understand FiveM ACEs and principals, create administration groups in a dedicated file, test each permission from the console and fix Access denied errors.
On this page
FXServer controls access to commands with a system of ACEs (access control entries) and principals. This guide explains how it makes its decisions, how to create your groups in a separate file, how to test each permission and how to remove access.
Prerequisites
- A server installed with the guide Create a FiveM Server
- Access to txAdmin, for Live Console, CFG Editor and the player list
- The identifier of the player you want to grant permissions to
Key Concepts
A rule reads as follows: this principal is allowed, or not, to access this object.
| Concept | Role | Examples |
|---|---|---|
| Principal | Who receives the permission | group.admin, identifier.license:abc123, resource.es_extended |
| Object | What is protected | command, command.quit, myserver.garage |
| ACE | An allow or deny rule |
add_ace group.admin command allow |
| Inheritance | A principal receives the permissions of another | add_principal identifier.license:abc123 group.admin |
The most common principals:
| Principal | Refers to |
|---|---|
identifier.license:... |
A player, by their Rockstar license. This is the safest identifier to use |
identifier.fivem:... |
A player, by their Cfx.re account |
identifier.discord:... |
A player, by their Discord account, only if Discord is detected when they connect |
player.1 |
Player number 1 of the current session. This number changes at each connection |
group.name |
A group that you define freely |
resource.name |
A resource, when it runs a command itself |
builtin.everyone |
Everyone |
How FXServer Decides
Four rules are enough to predict the result:
- Without a rule, access is denied. A principal has access to nothing by default.
- A permission covers its sub-objects.
commandcoverscommand.quit, andmyserver.garagecoversmyserver.garage.open. - A
denyoverrides anallow, regardless of the order of the lines. - A player is evaluated identifier by identifier. It is enough for one of their identifiers to be allowed for them to have access.
The fourth rule has an important consequence: a deny placed on identifier.license:abc123 does not block access if identifier.fivem:42, from the same player, is allowed. To remove a permission from a player, remove them from the group rather than adding a deny.
Step 1: Find the Player's Identifier
The player must have already connected to the server. In txAdmin, open their profile from the player list, then the IDs tab. You will find values such as license:abc123 or fivem:42.
For FXServer, add the identifier. prefix: license:abc123 becomes identifier.license:abc123.
Step 2: Create a Permissions File
A separate file keeps server.cfg readable. Locate the server folder, whose name ends in .base. If several folders appear, the right one is shown in Server Data Folder, under Settings, FXServer tab:
sudo find /home/fivem/txData -maxdepth 1 -type d -name '*.base'Open a fivem session, back up the configuration, then create the file:
sudo -iu fivem
BASE=/home/fivem/txData/FOLDER_NAME.base
cp "$BASE/server.cfg" "$BASE/server.cfg.before-permissions"
nano "$BASE/permissions.cfg"Example with a moderation group and an administration group, to adapt:
# Moderator permissions
add_ace group.moderator command.clientkick allow
add_ace group.moderator command.say allow
# Administrators inherit from moderators
add_principal group.admin group.moderator
# Administrator permissions
add_ace group.admin command allow
add_ace group.admin command.quit deny
# Team members
add_principal identifier.license:MODERATOR_LICENSE group.moderator
add_principal identifier.license:ADMIN_LICENSE group.adminLeave the session with exit.
Step 3: Load the File
In CFG Editor, add this line next to the permissions already present:
exec permissions.cfgThe path is relative to the server folder. Save, then apply the file without restarting by typing the same command in Live Console. It will be read again at the next startup anyway.
A connected player receives their new permissions immediately, without reconnecting.
Step 4: Test the Permissions
All of these commands are typed in Live Console. test_ace answers true or false:
test_ace identifier.license:MODERATOR_LICENSE command.clientkick
test_ace identifier.license:MODERATOR_LICENSE command.quit
test_ace group.admin command.quitWith the example above, you should get true, false, then false. The response looks like this:
identifier.license:MODERATOR_LICENSE -> command.clientkick = trueTo display everything that is loaded:
list_principals
list_aceslist_principals displays child <- parent, and list_aces displays principal -> object = ALLOW or DENY.
If a result surprises you, enable detailed tracing, repeat the action, then disable it:
se_debug true
se_debug falseThe console then shows each rule consulted, with TEST ACL [...] -> ALLOW or DENY lines.
Allowing a Command or a Resource
Open a restricted command to all players:
add_ace builtin.everyone command.mycommand allowAllow a resource to run a command. When a resource uses ExecuteCommand, it is the resource that must have the permission. Grant only the necessary command:
add_ace resource.my_resource command.add_principal allowProtect a function in your own script. Create a free-form object, then test it server-side with IsPlayerAceAllowed:
add_ace group.moderator myserver.garage allowif IsPlayerAceAllowed(source, 'myserver.garage') then
-- restricted action
endACE and Frameworks
Frameworks rely on this system, but each has its own method. Do not remove the add_ace resource... lines added by their recipe: they need them to work.
ESX Legacy
The player's group is stored in the group column of the users table. At each connection, ESX automatically adds the player to group.<their group>. So change the group with the dedicated command, in Live Console or in game, while the player is connected:
setgroup 1 adminHere, 1 is the player's number in the session.
QBCore
QBCore uses the god, admin and mod levels. For a lasting permission, place the license in permissions.cfg:
add_principal identifier.license:PLAYER_LICENSE qbcore.godThe in-game command /addpermission 1 god acts on player.1: it is lost as soon as the player disconnects.
txAdmin
The txAdmin interface accounts are independent of ACEs. Their permissions are managed in Admins and stored in admins.json. Giving group.admin to a player therefore does not give them access to txAdmin, and vice versa.
Removing a Permission
Delete the line from permissions.cfg, otherwise the permission will return at the next startup. Removing a line is not enough for the running server, because the rules stay in memory. Also type in Live Console:
remove_principal identifier.license:MODERATOR_LICENSE group.moderator
remove_ace group.moderator command.say allowThen check with test_ace. You can also restart the server, which starts again from the files only.
To completely undo your changes, remove the exec permissions.cfg line from CFG Editor, put back the server.cfg.before-permissions copy if needed, then restart the server.
Troubleshooting
Access denied for command
The message Access denied for command xxx. indicates who lacks the permission depending on the context:
- A player ran the command: test their identifier with
test_ace identifier.license:... command.xxx. - It appears when a resource starts, or without any player action: it is the resource that lacks the permission. Add
add_ace resource.name command.xxx allow.
With ESX, a message about add_principal or remove_principal often means that the add_ace resource.es_extended ... lines from the recipe have been removed.
No such config file: permissions.cfg
The file is not in the server folder, or its name is different. It must be next to server.cfg, and be readable by the fivem user. If in doubt, fix the owner:
sudo chown fivem:fivem /home/fivem/txData/FOLDER_NAME.base/permissions.cfgAccess type needs to be 'allow' or 'deny'
The add_ace or remove_ace line is badly written. Its form is add_ace principal object allow, with no other word.
test_ace answers true, but the player has no access
- Check that it is the same identifier, in the IDs tab of their profile.
- Do not use
identifier.discordif Discord was not open when they connected: prefer the license. - Check that the command is launched the way you think. A menu or a script may apply its own checks in addition to ACEs.
A deny does not block the player
The player is probably allowed through another of their identifiers. Find them with list_principals, then remove the player from the groups concerned.
The permission disappeared after a reconnection or a restart
It was given with player.N, or typed only in the console. Add it to permissions.cfg with identifier.license:....
A permission removed from the file still works
Rules that are already loaded stay active until restart. Use remove_ace or remove_principal, or restart the server.