On this page
- Why use TShock instead of the vanilla server?
- How do you prepare the system and a game account?
- How do you download and unpack TShock?
- How do you create the world and claim ownership?
- Which TShock settings should you change first?
- How do you run TShock under systemd with a console?
- Which firewall rule does Terraria need?
- How do you back up worlds and update TShock?
- What causes most join and startup problems?
- Questions
Why use TShock instead of the vanilla server?
TShock is a server mod built on the official Terraria server that adds accounts, permission groups, region protection, bans, item and projectile limits and a plugin system. On a public or semi public world those tools stop griefers and cheaters that the vanilla server cannot handle. Players still connect with the normal game client; no client mod is needed.
Memory use depends on world size: a small or medium world with a few players runs in 1 to 2 GB, and a large world with many players may need 3 to 4 GB. The game loop is single threaded, so a fast core helps, which makes the High Frequency line a good fit. The game servers overview covers cities and sizes.
How do you prepare the system and a game account?
Start with Ubuntu 24.04, Ubuntu 22.04, Debian 12 or Debian 13 and a sudo user (see first SSH session). TShock Linux releases are self contained .NET builds, which still need the ICU library and a few tools:
sudo apt update && sudo apt full-upgrade -y
sudo apt install -y unzip tmux curl
apt-cache search --names-only '^libicu[0-9]+$'
sudo apt install -y libicu74 # Ubuntu 24.04; use libicu70 on 22.04, libicu72 on Debian 12, libicu76 on Debian 13Install the ICU package that the search shows for your release. Then create an account that will own the server and worlds, so nothing runs as root:
sudo adduser --disabled-password --gecos "" terraria
sudo -iu terraria
mkdir -p ~/tshock-server ~/worldsHow do you download and unpack TShock?
Open the TShock releases page on GitHub, find the newest stable release whose name mentions the Terraria version your players run, and copy the link of the Linux x64 zip. Paste it into URL:
cd ~/tshock-server
URL="paste-the-linux-x64-release-zip-link-here"
curl -L -o tshock.zip "$URL"
unzip tshock.zip
lsRecent releases put a tar archive inside the zip. If ls shows a .tar file, unpack that as well and make the server binary executable:
tar -xf TShock-*.tar
chmod +x TShock.Server
./TShock.Server -help | headThe help output confirms the build runs on your system. A missing ICU library shows up here as an error mentioning globalization.
How do you create the world and claim ownership?
Run the server once in the foreground with the world options; -autocreate builds a world if the file does not exist (1 small, 2 medium, 3 large).
cd ~/tshock-server
./TShock.Server -port 7777 -maxplayers 8 \
-world /home/terraria/worlds/main.wld -autocreate 2 -worldname MainWorld generation takes a minute. When TShock finishes loading, it prints a setup code in the console. Join the server from the game (Multiplayer, Join via IP, 198.51.100.24, port 7777) and type in chat:
/setup 123456
/user add deploy a-strong-password owner
/login deploy a-strong-password
/setupThe first line grants temporary superadmin rights, the second creates your permanent owner account, and the final /setup turns the setup system off. Back at the server console, type off to save and stop.
Which TShock settings should you change first?
The main config is ~/tshock-server/tshock/config.json, written on first start. Edit it with the server stopped. Useful keys inside the Settings block:
ServerPassword: a join password for a private world.MaxSlots: player limit, matching-maxplayers.RequireLogin: set totrueso only registered accounts can play.DisableBuildandSpawnProtection: protect the spawn area from new players.RestApiEnabled: leavefalseunless you need remote management; it listens on port 7878.
Check the file stays valid JSON after editing:
python3 -m json.tool ~/tshock-server/tshock/config.json >/dev/null && echo validGroups and permissions live in the database next to the config and are managed with in game commands such as /group add builder and /user group name builder. Region protection uses /region define after you mark two corners.
How do you run TShock under systemd with a console?
The Terraria server expects an interactive console, so the unit below starts it inside a detached tmux session. That keeps a console you can attach to, and the stop command sends off so the world saves before exit. Leave the terraria shell with exit first.
sudo tee /etc/systemd/system/terraria.service >/dev/null <<'EOF'
[Unit]
Description=Terraria server (TShock)
After=network-online.target
Wants=network-online.target
[Service]
Type=forking
User=terraria
WorkingDirectory=/home/terraria/tshock-server
ExecStart=/usr/bin/tmux new-session -d -s terraria ./TShock.Server -port 7777 -maxplayers 8 -world /home/terraria/worlds/main.wld
ExecStop=/usr/bin/tmux send-keys -t terraria off Enter
ExecStop=/bin/sleep 20
Restart=on-failure
RestartSec=15
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now terraria
sudo ss -lntp | grep 7777To reach the console, run sudo -u terraria tmux attach -t terraria, and detach again with Ctrl+B then D. Typing save there writes the world without stopping.
Which firewall rule does Terraria need?
One TCP port: 7777 by default. Keep the REST port closed.
sudo ufw allow OpenSSH
sudo ufw allow 7777/tcp
sudo ufw enable
sudo ufw statusThe nftables version of the same rule is in firewall rules. If you would rather give players a name, add an A record such as terraria.example.net as explained in DNS records.
How do you back up worlds and update TShock?
Terraria keeps everything about the world in the .wld file, and TShock keeps accounts and regions in its database under tshock/. Save first, then archive both:
sudo -u terraria tmux send-keys -t terraria save Enter
sudo -u terraria tar -czf /home/terraria/backup-$(date +%F).tgz \
-C /home/terraria worlds tshock-server/tshockTShock also writes its own periodic world backups into tshock/backups. To update after a Terraria patch, wait for a TShock release that supports the new game version, stop the service, unpack the new release over the old folder (your tshock/ config and database stay), and start it again. The daily backups add-on provides an extra full copy.
What causes most join and startup problems?
- Version mismatch: clients updated before TShock did. Players can roll back through Steam betas, or you wait for the matching TShock build.
- Server exits at once: read
journalctl -u terraria -n 40and the logs intshock/logs; a brokenconfig.jsonis the usual cause. - Cannot connect: confirm the port with
sudo ss -lntpand the firewall withsudo ufw status. - Players kicked for odd reasons: TShock anti cheat limits, such as tile kill thresholds, can be raised in
config.json.
Plans that fit this guide
Base city prices. Every plan includes a dedicated IPv4 address, IPv6, full root and all 18 images.
Questions about Terraria server with TShock
Can mobile and console players join a TShock server?
Only PC players reliably can, and only when their client version matches the TShock build. Mobile and console versions use different releases.
Do players need TShock installed?
No. TShock runs only on the server; players connect with the normal game client.
Can I run more than one world?
Yes. Copy the server folder for each world, give each its own port with -port, its own tmux session name and systemd unit, and open each port in the firewall.
How do I upload an existing world?
Copy your local .wld file into /home/terraria/worlds/ with scp, set it as owner terraria, and point -world at it.
Are tModLoader mods supported?
No. tModLoader is a separate server with its own install. TShock uses server side plugins written in C# instead.