This commit is contained in:
abrown38 committed 2026-09-30 17:11:22 +00:00
1 parent 4f0886b6cd
commit 02017d470f
16 files changed
+2665 -84

No files matched your search

+5
View File
@@ -12,3 +12,8 @@
# Seconds to wait for a server to save and exit on stop (keep below 90)
#TERRARIA_STOP_TIMEOUT=80
# Where terractld (terractl daemon) listens for other hosts: an address and/or
# port. Default: all addresses, port 7776. After changing it:
# sudo systemctl restart terractld
#TERRACTL_LISTEN=10.0.10.77:7776
+23
View File
@@ -0,0 +1,23 @@
// Members of the 'terraria' group may start, stop and restart Terraria servers
// (terraria@<name>.service) without sudo. Nothing else: enable/disable and all
// other units still need root.
//
// Starting a name that has no instance yet creates a vanilla instance with
// default settings, as it does for root.
//
// Needs polkit 0.106 or newer (JavaScript rules); Ubuntu 22.04's 0.105 ignores it.
polkit.addRule(function(action, subject) {
if (action.id != "org.freedesktop.systemd1.manage-units" ||
!subject.isInGroup("terraria")) {
return polkit.Result.NOT_HANDLED;
}
// Same names terractl accepts (valid_name)
var unit = action.lookup("unit") || "";
var verb = action.lookup("verb") || "";
var verbs = ["start", "stop", "restart", "try-restart", "reset-failed"];
if (/^terraria@[A-Za-z0-9_][A-Za-z0-9_.-]*\.service$/.test(unit) &&
verbs.indexOf(verb) >= 0) {
return polkit.Result.YES;
}
return polkit.Result.NOT_HANDLED;
});