fix: use sudo

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-02-23 20:34:07 -05:00
parent f64999c8a2
commit fd6196def2
3 changed files with 23 additions and 6 deletions

View File

@@ -58,7 +58,12 @@ main() {
# Save admin password to temp file for testing/debugging (remove in production)
echo "$current_password" > /tmp/stalwart_admin_password
chmod 600 /tmp/stalwart_admin_password
# Use 644 so the invoking (non-root) runner user can read the file
chmod 644 /tmp/stalwart_admin_password
# If invoked via sudo, transfer ownership back to the calling user
if [ -n "${SUDO_USER:-}" ]; then
chown "$SUDO_USER" /tmp/stalwart_admin_password
fi
# Create domains if provided
if [ -n "$DOMAINS_JSON" ]; then