fix permissions subcommand

This commit is contained in:
abrown38 committed 2026-10-02 21:21:59 +00:00
1 parent c4a12727d4
commit ef63609db9
5 files changed
+34 -4

No files matched your search

+6 -2
View File
@@ -808,6 +808,7 @@ The servers always run as the `terraria` user. Administration is simplest with `
| `cmd` | root, or members of the `terraria` group | Same as `attach`. |
| `watch` | root, or members of the `terraria` group | Reads the servers' journal only. |
| `reinstall` | root (or `terraria`) | |
| `fix-perms` | root only | Checked by the script. |
| `mods <name>` (list) | root, or members of the `terraria` group | |
| `mods add/enable/disable/remove` | root (or `terraria`) | Run as root, it sets ownership of the files it installs to `terraria`. |
| `delete`, `rename` | root only | Checked by the script. |
@@ -837,9 +838,11 @@ Members of the `terraria` group can read server files (useful for backups) but c
The helper commands don't leave root-owned files behind, and `mods add` handles mods and ModConfigs. The remaining risk is **copying or creating other files in an instance directory as root**, such as worlds. The server can't write to root-owned files, so saving fails or tModLoader errors. After copying anything in, run:
```bash
sudo chown -R terraria:terraria /var/lib/terraria/instances/<name>
sudo terractl fix-perms <name>
```
This gives every file of the instance back to the `terraria` user and resets the modes to what the service creates: the `terraria` group can read everything but change nothing, and other users get no access. Files that were executable stay executable (and the server binaries are made executable again); setuid bits are removed. Symbolic links are left alone, so nothing outside the instance is changed. It's safe while the server is running.
Alternatively, copy files as the `terraria` user to begin with:
```bash
@@ -898,7 +901,7 @@ sudo systemctl start terraria@<name>
```
**The server can't save, or you see "Permission denied" errors.**
Some files are owned by root. Run `sudo chown -R terraria:terraria /var/lib/terraria/instances/<name>`.
Some files are owned by root, or have the wrong modes. Run `sudo terractl fix-perms <name>`.
**Players can't join a tModLoader server with a version-mismatch message.**
The player's tModLoader version differs from the server's. See [Versions and upgrades](#versions-and-upgrades).
@@ -972,6 +975,7 @@ terractl watch <name> [-n <lines>] [-q] Follow the output, read-only (
terractl cmd <name> <command...> Send one console command
terractl reinstall <name> [--clean] Re-unpack server/ on next start
(--clean also re-downloads .NET)
terractl fix-perms <name> Reset the owner and modes of all its files
terractl mods <name> [list] Show installed mods
terractl mods <name> add <folder|file.tmod>... Install and enable mods (and ModConfigs)
terractl mods <name> enable|disable <Mod>... Change which mods load