How groups, parents and permissions fit together
A permission is a dotted name that unlocks one thing. TShock's own descriptions read like a menu: tshock.admin.kick lets a user kick others, tshock.admin.ban lets them ban, tshock.admin.group lets them manage groups, and tshock.world.modify lets them modify the world. Most commands check exactly one permission.
Groups bundle permissions, and each group can have a parent. A group has everything it lists plus everything its parent has, all the way up the chain. That is why the default admin group only lists a handful of permissions yet can do a great deal: it inherits newadmin, which inherits vip, which inherits default, which inherits guest.
Groups and accounts are stored in tshock.sqlite in the tshock folder. TShock's documentation is blunt about that file: lose it and you set TShock up again, so include it in every backup.
- Permission: one dotted name, such as tshock.admin.kick
- Group: a list of permissions plus a parent group
- Account: belongs to exactly one group
- Everything is stored in tshock/tshock.sqlite
The groups TShock creates for you
On first start TShock creates a chain of groups. Players who have not logged in are in guest, the name set by DefaultGuestGroupName in config.json. Newly registered accounts land in default, set by DefaultRegistrationGroupName. Above them sits a ladder for trusted players and staff, each inheriting from the one below.
The source shows what each step adds. guest can build, chat, register and log in. default adds things such as warps, changing your password and summoning bosses. vip adds a reserved slot and starting invasions. newadmin adds kick, mute and editing spawn. admin adds ban, whitelist, teleports, broadcasts and spawning mobs. trustedadmin adds item, give, heal, god mode and the config and world permissions. owner adds group, region, item ban and tile ban management and /su. A separate insecure-guest group exists without a parent.
One more name is special. superadmin is reserved: TShock treats it as always existing, and it is the group the first-run setup code gives you temporarily. Do not create a group with that name.
- guest: unregistered players; build, chat, register, log in
- default: registered accounts; parent guest
- vip: parent default; reserved slot, invasions
- newadmin: parent vip; kick, mute, edit spawn
- admin: parent newadmin; ban, whitelist, teleport, broadcast
- trustedadmin: parent admin; give, heal, god mode, config and world permissions
- owner: parent trustedadmin; groups, regions, bans on items and tiles, /su
The /group commands
Using /group needs tshock.admin.group, which the owner group has. Commands can be typed in game chat with a slash, or in the server console. Permissions are separated by spaces, and /group addperm accepts several at once.
Two details save time. Giving * as the group name to addperm adds the permissions to every group in the system. And /group listperm shows only what a group lists itself, so remember the parent chain when a group can do more than its list suggests.
- /group add <name> [permissions]: create a group
- /group addperm <group> <permissions...>: add permissions
- /group delperm <group> <permissions...>: remove permissions
- /group parent <group> <parent group>: set the parent
- /group list and /group listperm <group>: show groups and a group's permissions
- /group prefix, suffix and color <group> <rrr,ggg,bbb>: how members look in chat
- /group rename <group> <new name> and /group del <group>
Example: a helper group, step by step
Say you want trusted players who can kick and mute but not ban. You could use newadmin, but a group of your own keeps your intentions clear and survives later changes to the defaults. Create it, give it a parent so it keeps everything a normal registered player has, add the two permissions, then move a player into it.
The player has to have an account first, either through /register in game or one you create. Moving accounts uses /user, which needs tshock.superadmin.user. That permission is not in any default group, so an owner either runs it from the server console, or elevates for a moment with /su, which TShock describes as elevating to superadmin for 10 minutes, or prefixes a single command with /sudo. The player is told straight away that their group changed.
- /group add helper
- /group parent helper default
- /group addperm helper tshock.admin.kick tshock.admin.mute
- /group prefix helper [Helper]
- /user group alice helper, from the console or with /sudo
- /group listperm helper to check
Wildcards and taking permissions away
TShock matches wildcards from the end of a permission name. A group with tshock.admin.* has every permission that starts with tshock.admin, and a group with * on its own has everything. Keep the bare * for nobody but yourself, since it grants every permission there is.
A permission that starts with an exclamation mark is negated. Negation is how you inherit almost everything from a parent but take one thing out. Give a moderators group the parent admin, then run /group addperm moderators !tshock.admin.ban, and its members can do everything admin can except ban. TShock checks the player's own group first and then each parent in turn, and the first group that mentions the permission decides, so the negated entry wins over the parent.
The same idea locks down guests. guest is the group for everyone who has not logged in, and it includes tshock.world.modify. Remove it with /group delperm guest tshock.world.modify and only logged-in players can change the world. To make everyone have an account before they play at all, set RequireLogin to true in config.json, which is false by default.
- tshock.admin.*: every tshock.admin permission
- *: everything, keep it for the owner at most
- !permission: removes a permission the group would inherit
- RequireLogin: false by default, true makes everyone log in
Spawn protection and a first check
Groups also decide who can build at spawn. TShock's SpawnProtection setting is on by default and protects a radius of 10 tiles around the spawn point, set by SpawnProtectionRadius in config.json. Players with tshock.world.editspawn ignore it, which in the default ladder means newadmin and above. Anyone with that permission can also toggle protection with /protectspawn.
After any change, test it with a second account that is in the group, not with your owner account, because the owner inherits nearly everything and will never see a refusal. For larger areas than spawn, the /region commands protect named areas, and regions are managed with tshock.admin.region. For installing TShock itself, the setup code and plugins, see our Terraria server guide, and for world size, port and password settings the Terraria serverconfig.txt generator. The Terraria game page shows the plan TShock comes ready on.