diff --git a/deploy/install.sh b/deploy/install.sh index eb5ddbe2..94fc7849 100644 --- a/deploy/install.sh +++ b/deploy/install.sh @@ -530,11 +530,15 @@ setup_sudoers() { cp "$INSTALL_DIR/sub2api-sudoers" /etc/sudoers.d/sub2api else # Create sudoers file + # Support both /bin/systemctl and /usr/bin/systemctl for different distros cat > /etc/sudoers.d/sub2api << 'EOF' # Sudoers configuration for Sub2API sub2api ALL=(ALL) NOPASSWD: /bin/systemctl restart sub2api sub2api ALL=(ALL) NOPASSWD: /bin/systemctl stop sub2api sub2api ALL=(ALL) NOPASSWD: /bin/systemctl start sub2api +sub2api ALL=(ALL) NOPASSWD: /usr/bin/systemctl restart sub2api +sub2api ALL=(ALL) NOPASSWD: /usr/bin/systemctl stop sub2api +sub2api ALL=(ALL) NOPASSWD: /usr/bin/systemctl start sub2api EOF fi diff --git a/deploy/sub2api-sudoers b/deploy/sub2api-sudoers index 8ce6da2c..fdd5400f 100644 --- a/deploy/sub2api-sudoers +++ b/deploy/sub2api-sudoers @@ -8,6 +8,10 @@ # SECURITY NOTE: This grants limited sudo access only for service management # Allow sub2api user to restart the service without password +# Support both /bin/systemctl (Debian/Ubuntu) and /usr/bin/systemctl (RHEL/CentOS) sub2api ALL=(ALL) NOPASSWD: /bin/systemctl restart sub2api sub2api ALL=(ALL) NOPASSWD: /bin/systemctl stop sub2api sub2api ALL=(ALL) NOPASSWD: /bin/systemctl start sub2api +sub2api ALL=(ALL) NOPASSWD: /usr/bin/systemctl restart sub2api +sub2api ALL=(ALL) NOPASSWD: /usr/bin/systemctl stop sub2api +sub2api ALL=(ALL) NOPASSWD: /usr/bin/systemctl start sub2api