# terraria-server-manager Run any number of vanilla Terraria and tModLoader dedicated servers on one Linux host, each managed as its own systemd service, with the `terractl` command. ## Contents 1. [Overview](#overview) 2. [Components](#components) 3. [Directory layout](#directory-layout) 4. [Installation](#installation) 5. [Migrating from the manual install](#migrating-from-the-manual-install) 6. [Server zips](#server-zips) 7. [Creating an instance](#creating-an-instance) 8. [Starting, stopping and boot](#starting-stopping-and-boot) 9. [The server console](#the-server-console) 10. [Configuration](#configuration) 11. [Mods (tModLoader)](#mods-tmodloader) 12. [Versions and upgrades](#versions-and-upgrades) 13. [Deleting, renaming and restoring](#deleting-renaming-and-restoring) 14. [Exporting and importing](#exporting-and-importing) 15. [Managing other hosts](#managing-other-hosts) 16. [Backups](#backups) 17. [Permissions](#permissions) 18. [Running by hand for debugging](#running-by-hand-for-debugging) 19. [Troubleshooting](#troubleshooting) 20. [Tab completion](#tab-completion) 21. [Command reference](#command-reference) --- ## Overview Each server is an **instance** with a short name such as `survival` or `calamity`. An instance is: - a directory, `/var/lib/terraria/instances//`, holding everything about that server; - a systemd service, `terraria@.service`, that runs it as the unprivileged `terraria` user. Server software is never installed by hand. You drop the official zips into `/var/lib/terraria/dist`, and the first time an instance starts, the right zip is unpacked into that instance's `server/` folder. Worlds, mods and settings live separately in `data/`, so server software can be replaced or upgraded without touching them. Each instance chooses between **vanilla** and **tModLoader** independently, so both kinds can run side by side on different ports. --- ## Components Everything is installed by the `terraria-server-manager` package: | File | Purpose | |---|---| | `/usr/lib/systemd/system/terraria@.service` | Template service. One copy runs per instance. | | `/usr/lib/systemd/system/terraria@.socket` | Creates the console pipe the server reads commands from. | | `/usr/bin/terractl` | Helper script. The service calls it to set up, run and stop servers; you use it for everyday management. | | `/usr/lib/terraria-server-manager/terractl-remote` | The part of `terractl` that manages other hosts (`--host`, `remote`, `daemon`, `copy`, `move`), in Python. | | `/usr/lib/systemd/system/terractld.service` | The daemon that lets other hosts manage this one. Off until you turn it on (see [Managing other hosts](#managing-other-hosts)). | | `/etc/default/terractl` | Optional overrides (locations, stop timeout, the daemon's address). | | `/etc/systemd/journald@terraria.conf` | Size and retention of the servers' own journal (see [Logs](#logs)). | | `/usr/lib/sysusers.d/terractl.conf` | Defines the `terraria` system user. | | `/usr/lib/tmpfiles.d/terractl.conf` | Creates `/var/lib/terraria` and its subdirectories. | | `/usr/share/polkit-1/rules.d/50-terractl.rules` | Lets members of the `terraria` group start, stop and restart servers without `sudo`. | | `/usr/share/terraria-server-manager/export-tmod-mods.ps1` | Optional. Copy to your Windows PC to collect your enabled tModLoader mods. | What happens when an instance starts: 1. systemd creates the console pipe `/run/terraria/.stdin` (from the socket unit). 2. `terractl prepare ` creates the instance directory and default configs if they're missing, and unpacks the server zip if it hasn't been unpacked yet. 3. `terractl run ` starts the vanilla or tModLoader server, reading commands from the pipe and logging to the servers' own journal (see [Logs](#logs)). On stop, `terractl service-stop` sends `exit` through the pipe so the world is saved before the server shuts down. --- ## Directory layout ``` /var/lib/terraria/ Home of the 'terraria' user ├── dist/ Server zips (you add these; never modified) │ ├── terraria-server-1458.zip │ └── tModLoader-v2026.07.3.0.zip └── instances/ ├── / One directory per instance │ ├── instance.conf Which server type and zip to use │ ├── serverconfig.txt Terraria's own settings (port, world, password...) │ ├── server/ Unpacked server software (replaceable) │ │ └── .installed Records what was unpacked │ └── data/ Your data (never touched by upgrades) │ ├── Worlds/ World files │ ├── Mods/ tModLoader mods + enabled.json │ ├── ModConfigs/ tModLoader mod settings │ └── banlist.txt ├── .backups/ Backups made by 'terractl upgrade' └── .deleted/ Backups made by 'terractl delete' /run/terraria/.stdin Console pipe (exists only while running) /var/lib/terractl/ The daemon's certificate and trusted computers (root only) ``` The server can write only inside `instances/`. It reads `dist/` but can never change it. --- ## Installation The package works on Debian 12 or newer and Ubuntu 22.04 or newer. The easiest way is the apt repository, since `sudo apt upgrade` then keeps it up to date: ```bash sudo install -d -m 0755 /etc/apt/keyrings sudo curl -fsSL https://gitea.adbraun.lol/api/packages/adam/debian/repository.key \ -o /etc/apt/keyrings/terraria-server-manager.asc echo "deb [signed-by=/etc/apt/keyrings/terraria-server-manager.asc] https://gitea.adbraun.lol/api/packages/adam/debian stable main" | sudo tee /etc/apt/sources.list.d/terraria-server-manager.list sudo apt update sudo apt install terraria-server-manager ``` The repository is signed; the first two commands fetch its key and let apt trust it for this repository only. Alternatively, download a `.deb` from the releases page and install it directly: ```bash sudo apt install ./terraria-server-manager_0.0.9_all.deb ``` Using `apt install` (rather than `dpkg -i`) installs the dependencies automatically. `unzip` is required. `curl` and the ICU library are "recommended", which apt installs by default; they're only needed for tModLoader instances, which crash with `Aborted` without ICU. `polkitd` is also recommended: it lets members of the `terraria` group start and stop servers without `sudo` (see [Permissions](#permissions)). Installing the package: - creates the `terraria` system user and group; - creates `/var/lib/terraria/`, `/var/lib/terraria/instances/` and `/var/lib/terraria/dist/`; - installs the units, the helper script and the polkit rule. It doesn't start or enable anything, including the daemon for managing the host from elsewhere. If you use a firewall, open each instance's port for **TCP**. Terraria uses TCP only. ```bash sudo ufw allow 7777/tcp # example with ufw ``` ### Upgrading the package ```bash sudo apt update && sudo apt upgrade # from the apt repository sudo apt install ./terraria-server-manager__all.deb # or from a downloaded .deb ``` Running servers are not restarted. Each one picks up the new version the next time it starts. Your changes to `/etc/default/terractl` are kept; if the new package also changes that file, dpkg asks which version to keep. ### Removing the package ```bash sudo apt remove terraria-server-manager # stops all instances (worlds are saved first) sudo apt purge terraria-server-manager # also removes config and boot-time enablement ``` Neither command deletes `/var/lib/terraria`, the servers' journal or the `terraria` user, so your worlds survive even a purge. To delete everything: ```bash sudo rm -rf /var/lib/terraria && sudo userdel terraria ``` ### Upgrading from the `terraria-instance` package Versions before 0.0.6 were packaged as `terraria-instance`, and the command had the same name. The new package declares that it replaces the old one, so installing it removes `terraria-instance` automatically: ```bash sudo apt install ./terraria-server-manager_0.0.9_all.deb ``` Things to know: - **Instances are stopped (and saved) during the switch**, because removing the old package stops them. Start them again afterwards with `sudo systemctl start terraria@`. Instances, worlds, mods and the `terraria` user all carry over unchanged. - **The command is now `terractl`.** Update any scripts or cron jobs that call `terraria-instance`. **Clean up the old package straight after upgrading.** The old package is removed, but dpkg still keeps a record of it because its settings file is left behind. Purging that record, including with a general cleanup like `apt purge ~c` or `apt autoremove --purge`, runs the old package's purge step. Because the instances have the same unit names, that step deletes their start-at-boot links. So purge it deliberately, then re-enable the instances: ```bash # 1. If you customised it, copy the old settings file across (purging deletes it) sudo cp /etc/default/terraria-instance /etc/default/terractl # 2. Note which instances start at boot, purge the old package, re-enable them enabled=$(ls /etc/systemd/system/multi-user.target.wants/ | grep '^terraria@') sudo apt purge terraria-instance for unit in $enabled; do sudo systemctl enable "$unit"; done ``` ### Building from source From the git repository: ```bash make check # syntax-check the scripts (and shellcheck, if installed) make deb # builds build/terraria-server-manager__all.deb sudo make install # or install directly without a package (PREFIX=/usr/local) sudo make uninstall # removes a 'make install' (keeps settings and data) ``` `make install` with a prefix other than `/usr` puts the polkit rule in `/etc/polkit-1/rules.d/`, because polkit doesn't read `/usr/local`. The version comes from the `VERSION` file. Set `Maintainer:` in `packaging/deb/control` to yourself before publishing packages. ### Changing locations The servers run in a systemd sandbox: they can write only to `/var/lib/terraria/instances`, they can read but not change the rest of the system, and they can't see `/home` at all. These rules are in the unit files, which can't read `/etc/default/terractl`. So if the instances or zips go somewhere else, the services must be told as well. **The simplest way: mount the storage at the usual place.** To keep instances on another disk, mount it (or a folder on it) at `/var/lib/terraria/instances`, and change no settings at all. For a folder on a disk that's already mounted, add a bind mount to `/etc/fstab`: ``` /srv/bigdisk/terraria /var/lib/terraria/instances none bind 0 0 ``` ```bash sudo systemctl stop 'terraria@*' # if servers are running sudo cp -a /var/lib/terraria/instances/. /srv/bigdisk/terraria/ # copy existing instances over sudo mount /var/lib/terraria/instances sudo chown terraria:terraria /var/lib/terraria/instances sudo chmod 0750 /var/lib/terraria/instances ``` The old copies stay hidden underneath the mount. Once everything works, you can free that space: `sudo umount /var/lib/terraria/instances`, delete the old instance folders, and `sudo mount /var/lib/terraria/instances` again. The same works for `dist/`. Use a mount, not a symbolic link: systemd follows a link to where it really points, and that place isn't covered by the sandbox rules. **Or change the setting, and add a drop-in.** Set `TERRARIA_BASE` and/or `TERRARIA_DIST` in `/etc/default/terractl`, create the folders with the same owners and modes as the default ones, and let the servers write to the new instances folder: ```bash sudo install -d -o terraria -g terraria -m 0750 /srv/terraria/instances sudo install -d -o root -g terraria -m 2775 /srv/terraria/dist sudo systemctl edit terraria@.service ``` ```ini [Service] ReadWritePaths=/srv/terraria/instances ``` A zips folder outside `/home` needs no drop-in, because the servers only read it. `terractl list`, `new`, `import` and `enable` check that the services can reach both folders, and print the exact drop-in to add if they can't. A server that can't create its folder says so in its log, with the same advice. If the daemon for other hosts (`terractld.service`) is on, it's checked too; it only needs a drop-in for folders under `/home` (see below). ### Instances or zips under `/home` This works, but needs more changes, because the services are set up to never touch home folders (`ProtectHome=yes`). That hides `/home`, `/root` and `/run/user` from them completely. Prefer a folder outside `/home`, or a bind mount (above), if you can. If they must be under `/home`: 1. **Let the services see `/home`, read-only, and write to the instances folder.** For the servers: ```bash sudo systemctl edit terraria@.service ``` ```ini [Service] ProtectHome=read-only ReadWritePaths=/home/you/terraria/instances ``` If the daemon for other hosts is on, it also needs to write to the zips folder, because copying an instance here can bring its server zip along: ```bash sudo systemctl edit terractld.service ``` ```ini [Service] ProtectHome=read-only ReadWritePaths=/home/you/terraria/instances /home/you/terraria/dist ``` `ProtectHome=read-only` lets the servers see all home folders. Normal file permissions still apply, so as the `terraria` user they can only read what other users can. 2. **Let the `terraria` user into the folders above.** On Ubuntu (21.04 and later) and some other systems, home folders are private (mode `750`), so the `terraria` user can't even pass through `/home/you`. Give it just that, without letting it list or read anything there: ```bash sudo setfacl -m u:terraria:x /home/you ``` Do the same for every folder between `/home/you` and the instances or zips folder that isn't open to others. `sudo -u terraria ls /home/you/terraria/instances` tells you whether it worked. 3. **Create the folders** with the right owners and modes, and set `TERRARIA_BASE` and/or `TERRARIA_DIST` in `/etc/default/terractl`, as above. 4. **Restart running servers** so they pick up the drop-in: `sudo terractl restart `. If the daemon is on: `sudo systemctl restart terractld`. `terractl list` stops warning once the drop-ins match. Members of the `terraria` group also need to get through `/home/you` to use `list`, `info` and tab completion without `sudo`. --- ## Migrating from the manual install The earlier manual setup used `/opt/terraria`, `/terraria`, and a script called `terraria-instance` in `/usr/local/bin`. To move to the package: ```bash # 1. Note which instances start at boot, then stop everything ls /etc/systemd/system/multi-user.target.wants/ | grep terraria@ sudo systemctl stop 'terraria@*' # 2. Remove the old files. These would override the package's versions: # /etc/systemd/system takes precedence over /usr/lib/systemd/system, and # /usr/local/bin comes before /usr/bin in PATH. sudo rm /etc/systemd/system/terraria@.service /etc/systemd/system/terraria@.socket sudo rm /usr/local/bin/terraria-instance # 3. Install the package (keeps the existing 'terraria' user) sudo apt install ./terraria-server-manager_0.0.9_all.deb # 4. Move instances and zips for d in /opt/terraria/*/; do [ -f "$d/instance.conf" ] && sudo mv "$d" /var/lib/terraria/instances/ done [ -d /opt/terraria/.deleted ] && sudo mv /opt/terraria/.deleted /var/lib/terraria/instances/ sudo mv /terraria/*.zip /var/lib/terraria/dist/ # 5. serverconfig.txt contains absolute paths; update them sudo sed -i 's#/opt/terraria/#/var/lib/terraria/instances/#g' \ /var/lib/terraria/instances/*/serverconfig.txt sudo chown -R terraria:terraria /var/lib/terraria/instances # 6. Re-enable instances (the old boot links point at the deleted unit file) sudo systemctl reenable terraria@calamity # repeat for each instance from step 1 sudo systemctl start terraria@calamity ``` Alternatively, you can move instances one at a time with `import`, which updates the paths in `serverconfig.txt` and sets ownership for you: `sudo tar -czf /tmp/calamity.tar.gz -C /opt/terraria calamity`, then `sudo terractl import calamity /tmp/calamity.tar.gz`. Once everything works, remove the old directories: `sudo rm -rf /terraria /opt/terraria`. If you set `ZIP=` in an `instance.conf` to an absolute path under `/terraria`, change it to just the file name. The existing `terraria` user keeps `/opt/terraria` as its home directory. That's harmless, because the script sets a per-instance home itself. To tidy it anyway, run `sudo usermod -d /var/lib/terraria terraria` after deleting `/opt/terraria`. --- ## Server zips Put the official downloads in `/var/lib/terraria/dist`: | Type | File name pattern | Where to get it | |---|---|---| | Vanilla | `terraria-server-*.zip` | terraria.org (the "PC Dedicated Server" download link) | | tModLoader | `tModLoader*.zip` | tModLoader's GitHub releases page (`tModLoader.zip`) | **Rename tModLoader zips to include the version**, for example `tModLoader-v2026.07.3.0.zip`. GitHub always calls the file `tModLoader.zip`, so renaming it lets you keep several versions side by side and pin instances to specific ones. Zips are only read, never changed, and one zip can serve any number of instances. **tModLoader zips don't include .NET.** Each tModLoader instance downloads the .NET runtime it needs into `server/dotnet/` on its first start, so that start needs internet access and `curl`. The download is kept when you upgrade or re-unpack the instance. tModLoader checks the .NET version on every start and fetches a different one itself if a new release needs it. **The `terraria` user must be able to read the zips.** Files copied in normally are fine, but `scp -p` or `cp -p` of a private file keeps its `600` mode, and a server can't be installed from that. `terractl list` warns about such zips, and a server that fails to start because of one says so in its log. Fix them with `sudo chmod 644 /var/lib/terraria/dist/*.zip`. Members of the `terraria` group can copy zips into `dist/` without `sudo`: ```bash scp tModLoader-v2026.07.3.0.zip you@yourserver:/var/lib/terraria/dist/ ``` --- ## Creating an instance ```bash sudo terractl new [vanilla|tmodloader] [port] ``` Examples: ```bash sudo terractl new survival # vanilla, next free port sudo terractl new calamity tmodloader # tModLoader, next free port sudo terractl new pvp vanilla 7800 # vanilla on port 7800 ``` If you don't give a port, the instance gets the next number after the highest port already used, starting at 7777. This creates `/var/lib/terraria/instances//` with `instance.conf` and `serverconfig.txt`, but **does not start the server**. Before the first start, review `serverconfig.txt` (world size, difficulty, password). For a tModLoader instance, also add your mods first (see [Mods](#mods-tmodloader)): the world is generated on first start, and it should be generated with the mods loaded so their world content is created. Instance names may contain letters, digits, `_`, `-` and `.`, and must not start with `.`. ### Quick start: a new modded server ```bash sudo terractl new calamity tmodloader sudo terractl mods calamity add ~/tmod-export # your mods, before the first start sudo nano /var/lib/terraria/instances/calamity/serverconfig.txt # optional: world size, difficulty sudo terractl enable calamity --now sudo terractl attach calamity # watch it load and generate the world ``` You can also skip `new` and just run `sudo systemctl start terraria@`. That creates a **vanilla** instance with default settings; to switch it to tModLoader, change `TYPE` in its `instance.conf` and restart. --- ## Starting, stopping and boot Instances are ordinary systemd services, which `terractl` starts and stops for you: ```bash sudo terractl start calamity sudo terractl stop calamity # saves the world, then exits sudo terractl restart calamity ``` These are the same as `systemctl start|stop|restart terraria@`, which work too; `systemctl status terraria@` shows the details. `terractl start` refuses names that have no instance, whereas `systemctl start` creates one. Whether a server starts at boot is set with `terractl`: ```bash sudo terractl enable calamity # start at boot sudo terractl enable calamity --now # start at boot, and start it now sudo terractl disable calamity # don't start at boot (a running server keeps running) sudo terractl disable calamity --now # don't start at boot, and stop it now (saves the world) ``` These do the same as `systemctl enable`/`disable terraria@`, which also still work. `terractl enable` refuses names that have no instance, so a typo can't create a new instance at the next boot. Members of the `terraria` group can `start`, `stop` and `restart` servers without `sudo` (see [Permissions](#permissions)). `enable` and `disable` always need `sudo`. To see all instances with their type, port, whether they start at boot, and state: ```bash sudo terractl list ``` ``` INSTANCE TYPE PORT BOOT STATE calamity tmodloader 7778 enabled active survival vanilla 7777 disabled inactive ``` Behaviour to be aware of: - **Crashes restart automatically** after 10 seconds. - **A clean exit does not restart.** If you type `exit` in the server console, the server saves and stops, and stays stopped until you start it again. - **The first start of a tModLoader instance is slow.** It downloads .NET, loads the mods and generates the world, which can take several minutes. - **Stopping waits for the save.** The server gets up to 80 seconds to save and exit before systemd forces it to stop. --- ## The server console Each server reads console commands (`save`, `say`, `kick`, `playing`, and so on) from its pipe, and its output goes to the servers' own journal. ### Interactive: `attach` ```bash sudo terractl attach calamity ``` This shows the last 30 lines of output and then follows it live. Anything you type is sent to the server, with arrow-key editing and history. **Ctrl-D** or **Ctrl-C** detaches, and the server keeps running. `attach` will not send `exit`, since that would stop the server. Use `terractl stop` to stop it. The one visible difference from a real terminal: the server's `:` prompt only appears once a newline follows it. ### Read-only: `watch` ```bash terractl watch calamity # last 30 lines, then follow terractl watch calamity -n 200 # start with the last 200 lines terractl watch calamity -q # without the lines about what it's doing ``` `watch` shows the server's output like `attach` does, but never sends anything to the server. That makes it safe to leave open, for instance on a second screen, with no risk of typing into the console. **Ctrl-C** quits and the server keeps running. It also works while the server is stopped: it shows the last output and picks up again when the server starts. ### One-off commands: `cmd` ```bash sudo terractl cmd calamity save sudo terractl cmd calamity say Restarting in 5 minutes ``` `cmd` prints the server's reply, then returns once the server has been quiet for a second (at most 5 seconds). For example, `terractl cmd calamity playing` lists who's online. That makes it handy in scripts and cron jobs too. If the server doesn't answer within 5 seconds (for instance while it's still loading), `cmd` says so; the command has still been sent. Members of the `terraria` group can use `attach`, `watch` and `cmd` fully, output included, without `sudo`. See [Logs](#logs) for how that's arranged. ### Logs The servers don't log into the main system journal. They have **their own journal**, a systemd *log namespace* called `terraria`. That keeps them separate for two reasons: - **Access.** The `terraria` group is given read access to the servers' journal and nothing else, so moderators can follow the game servers without being able to read the rest of the system's logs (logins, `sudo` use, other services). - **Space.** Chatty game servers can't push system logs out of a size-limited journal, or the other way round. To read it with `journalctl`, add `--namespace=terraria`: ```bash journalctl --namespace=terraria -u terraria@calamity -f # follow journalctl --namespace=terraria -u terraria@calamity -n 100 # last 100 lines journalctl --namespace=terraria -u terraria@calamity --since today journalctl --namespace=+terraria -u terraria@calamity # also systemd's own start/stop messages ``` Plain `journalctl -u terraria@calamity`, without `--namespace`, only shows systemd's messages about the service (started, stopped, failed), not the server's output. With `+terraria`, both are shown together; that part needs root or the `systemd-journal` group, because systemd's messages are in the system journal. **Size and retention** are set in `/etc/systemd/journald@terraria.conf`, which by default allows up to 256 MB on disk. After editing it, run `sudo systemctl restart systemd-journald@terraria`. **How the group access works.** Before each server starts, a small root step (`terractl journal-access`) creates the servers' journal folder, `.terraria` under `/var/log/journal` (or `/run/log/journal` if the system doesn't keep logs across reboots). It gives that folder a read permission for the `terraria` group, which journald's files inherit, including after log rotation. It never creates `/var/log/journal` itself, because that would switch the whole system to persistent logging. tModLoader also writes its own logs to `/var/lib/terraria/instances//server/tModLoader-Logs/`: - `Launch.log` covers the .NET download and startup. - `server.log` covers mod loading and gameplay. --- ## Configuration Each instance has two config files for two different purposes. ### `serverconfig.txt`: Terraria's settings This is Terraria's standard server config, read by the game itself. The generated default: ```ini world=/var/lib/terraria/instances//data/Worlds/.wld worldpath=/var/lib/terraria/instances//data/Worlds autocreate=2 # create world if missing: 1=small 2=medium 3=large worldname= difficulty=0 # 0=classic 1=expert 2=master 3=journey #seed= port=7777 maxplayers=8 password= motd=Welcome to secure=1 upnp=0 language=en-US banlist=/var/lib/terraria/instances//data/banlist.txt ``` `autocreate`, `worldname`, `difficulty` and `seed` only matter when the world file doesn't exist yet. Once the world has been created, changing them has no effect. Changes take effect on restart. Every instance must use a different `port`. To use an existing world, copy the `.wld` file (plus `.twld` for tModLoader worlds) into `data/Worlds/` and point `world=` at it. ### `instance.conf`: how the instance runs The game never reads this file. The helper script reads it at every start. ```bash TYPE=tmodloader # vanilla | tmodloader ZIP= # zip to use; blank = newest matching zip at first install EXTRA_ARGS=() # extra server arguments, as a bash array ``` | Setting | Effect | |---|---| | `TYPE` | Which server software runs. Changing it re-unpacks `server/` from the other kind of zip on the next start. `data/` and `serverconfig.txt` are kept. | | `ZIP` | Pins a specific zip from `/var/lib/terraria/dist` (a file name, or an absolute path). Changing it re-unpacks `server/` on the next start; `terractl upgrade` sets it for you (see [Upgrading](#upgrading-or-downgrading-an-instance)). If left blank, the newest matching zip is used at first install and **never upgraded automatically**. | | `EXTRA_ARGS` | Extra command-line arguments, e.g. `EXTRA_ARGS=(-disableannouncementbox)`. | This file also marks the directory as an instance: `list` ignores directories without one, and `delete` refuses to remove them. --- ## Mods (tModLoader) Mods only work on tModLoader instances. Each instance has its own separate set of mods: ``` /var/lib/terraria/instances//data/Mods/ ├── enabled.json ["CalamityMod", "MagicStorage"] ├── CalamityMod.tmod └── MagicStorage.tmod ``` `enabled.json` lists which mods to load, using each file's name without `.tmod`. Every mod's dependencies must also be present and listed. Mod settings live in `data/ModConfigs/`. You don't need to edit these by hand: `terractl mods` manages them and sets the file ownership correctly (see [Managing mods](#managing-mods)). The `Mods` folder is created automatically for tModLoader instances. Players don't need to install mods themselves: tModLoader offers to download the server's mods when they join. ### Exporting mods from Windows tModLoader on Windows keeps its files in these places: | What | Where | |---|---| | Which mods are enabled | `Documents\My Games\Terraria\tModLoader\Mods\enabled.json` | | Workshop mods | `\steamapps\workshop\content\1281930\\` | | Manually installed mods | `Documents\My Games\Terraria\tModLoader\Mods\` | | Mod settings | `Documents\My Games\Terraria\tModLoader\ModConfigs\` | Workshop mods often contain **several builds**, in folders named after the tModLoader version they target (`2024.3`, `2025.3`, ...). The game loads the build from the highest folder that isn't newer than the running tModLoader. `export-tmod-mods.ps1` applies the same rule. It's installed on the server at `/usr/share/terraria-server-manager/`; copy it to your PC first. It collects every enabled mod, a matching `enabled.json` and your mod settings into `Desktop\tmod-export`, laid out like the server's `data/` folder. Run it in PowerShell: ```powershell powershell -ExecutionPolicy Bypass -File .\export-tmod-mods.ps1 -MaxVersion 2026.7 ``` Set `-MaxVersion` to your tModLoader version as year.month. The full version is shown at the bottom-left of tModLoader's main menu, e.g. `v2026.07.3.0` → `2026.7`. For the preview branch, add `-TmlDir "$HOME\Documents\My Games\Terraria\tModLoader-preview"`. The script prints which file it chose for each mod, and warns about any it couldn't find. It leaves missing mods out of `enabled.json`, because one missing file would stop the server loading any mods. ### Copying mods to the server Copy the export folder to the server. `scp` is built into Windows 10 and 11: ```powershell scp -r "$HOME\Desktop\tmod-export" you@yourserver: ``` This puts it in your home directory on the server. Then install the mods into the instance: ```bash sudo terractl mods calamity add ~/tmod-export sudo systemctl restart terraria@calamity # only if it's already running ``` `add` copies the `.tmod` files and any `ModConfigs`, gives them to the `terraria` user, and adds them to `enabled.json`. For a new instance, do this **before the first start** so the world is generated with the mods loaded. ### Managing mods ```bash terractl mods # list installed mods and whether each is enabled terractl mods add ... # install and enable terractl mods disable ... # keep installed, but don't load terractl mods enable ... # load again terractl mods remove ... # uninstall ``` `add` accepts `.tmod` files, a folder containing them, or an export folder with `Mods/` and `ModConfigs/` subfolders. Mod names are the file names without `.tmod`, e.g. `CalamityModMusic`. Adding a mod that's already installed replaces it, which is how you update a mod. Changes take effect when the server restarts; the command reminds you if it's running. The list also flags mods that are **enabled but missing**, because the server won't load any mods while one is missing. `add` doesn't check dependencies, so remember to add them too. If one is missing, `server/tModLoader-Logs/server.log` says which. --- ## Versions and upgrades ### Players must match the server's version - **Vanilla:** players need the same Terraria version as the server's zip. For example, `terraria-server-1458.zip` is Terraria 1.4.5.8. - **tModLoader:** players need exactly the same tModLoader version, including the same branch (stable or preview). Steam updates players' tModLoader automatically, usually monthly, so a server that was matching can become mismatched after an update. Stable tModLoader and the latest vanilla Terraria can be based on different Terraria versions. That's fine, because every instance runs independently. ### Upgrading (or downgrading) an instance Put the new zip in `/var/lib/terraria/dist`, with the version in its name (see [Server zips](#server-zips)). To see which zips an instance can use and which one it runs: ``` $ terractl upgrade calamity 'calamity' (tmodloader) runs: tModLoader-v2026.06.1.0.zip ZIP NOTE tModLoader-v2026.06.1.0.zip installed, pinned tModLoader-v2026.07.3.0.zip newest Change version with: sudo terractl upgrade calamity |latest ``` Then switch to it, by name or with `latest` (the newest zip of the instance's type): ```bash sudo terractl upgrade calamity tModLoader-v2026.07.3.0.zip sudo terractl upgrade calamity latest ``` `upgrade` applies the change right away, in this order: 1. **Checks the zip** before changing anything: it must be in `dist/`, match the instance's type, be readable by the `terraria` user, contain the server, and pass `unzip -t`. A damaged or half-downloaded zip is refused here, not on the next start. 2. **Stops the server** if it's running. Stopping saves the world. 3. **Backs up** the worlds and configs (not `server/`) to `/var/lib/terraria/instances/.backups/--.tar.gz`, readable only by root. Use `--no-backup` to skip this. 4. **Pins `ZIP=`** in `instance.conf` to the new zip, so the version can't change by accident afterwards. 5. **Unpacks the new zip** into `server/`. For tModLoader, the .NET runtime and logs are kept, as always. If this fails, the old pin is put back and the old `server/` is still in place, so the instance is exactly as it was. 6. **Starts the server again** if it was running. Nothing in `data/` is changed by `upgrade` itself. But once the new version saves a world, older versions can't open it. **Downgrades need `--downgrade`.** `upgrade` compares the version in the zip names, and refuses to go to an older one without it: ```bash sudo terractl upgrade calamity tModLoader-v2026.06.1.0.zip --downgrade ``` Downgrading only changes the server software. If worlds have already been saved by the newer version, restore them from the backup as well (see [Undoing an upgrade](#undoing-an-upgrade)). **Pin `ZIP=` on modded instances.** `upgrade` always pins, and pinned instances never change version by accident. New tModLoader versions can break older mods, so only upgrade a modded server once its mods support the new version. After upgrading, check that the mods load with `terractl watch calamity`. You can still change version by hand: set `ZIP=` in `instance.conf` and restart. That skips the checks and the backup, and a bad zip only shows up when the server fails to start. ### Undoing an upgrade To go back to the old version *and* the worlds as they were before the upgrade, replace the instance with the backup `upgrade` made. The backup is in the same format as `export`, so `import` restores it, pinned to the version it was taken with: ```bash sudo ls /var/lib/terraria/instances/.backups/ sudo terractl delete calamity -y # keeps its own backup in .deleted/, just in case sudo terractl import calamity /var/lib/terraria/instances/.backups/calamity-20261002-213553-tModLoader-v2026.06.1.0.tar.gz sudo terractl enable calamity --now ``` Anything played since the upgrade is lost this way. The backups are never deleted automatically; remove old ones with `sudo rm`. ### Re-unpacking the same version If `server/` gets damaged or you want a clean copy: ```bash sudo terractl reinstall calamity sudo terractl restart calamity ``` `reinstall` unpacks the **same** zip again on the next start; it never changes version. If `ZIP=` is blank, it first pins the zip the instance runs, because otherwise the next start would pick the newest zip in `dist/`. If that zip is no longer in `dist/`, it says so and changes nothing: put the zip back, or use `upgrade`. For tModLoader, the downloaded .NET runtime and `tModLoader-Logs/` are kept. If you suspect .NET itself is damaged, use `--clean` to delete them too, so .NET is downloaded again on the next start: ```bash sudo terractl reinstall calamity --clean sudo terractl restart calamity ``` --- ## Deleting, renaming and restoring ```bash sudo terractl delete calamity # asks you to type the name sudo terractl delete calamity -y # no prompt sudo terractl delete calamity -y --no-backup # permanently, no backup ``` This stops and disables the service, then removes the whole instance directory. Unless you pass `--no-backup`, it first archives the configs and `data/` to `/var/lib/terraria/instances/.deleted/-.tar.gz`. `server/` is left out of the archive because it can be recreated from the zip. To restore an instance, import its backup. You can give it back its old name, or a new one: ```bash sudo terractl import calamity /var/lib/terraria/instances/.deleted/calamity-20260928-134422.tar.gz sudo terractl enable calamity --now # server/ is unpacked again on start ``` `.deleted/` is never cleaned up automatically. Remove old archives yourself. To give an instance another name, use `rename`. It stops the server if it's running, renames the folder, updates the paths in `serverconfig.txt`, and starts it again under the new name. The port, world, mods and unpacked server stay as they are, and if it started at boot, it still does: ```bash sudo terractl rename calamity calamity-old ``` --- ## Exporting and importing `export` packs an instance into a single `.tar.gz` file, and `import` turns such a file back into an instance. Use them for backups, for moving a server to another machine, or for making a copy to experiment on. ```bash sudo terractl export calamity # ./calamity--