diff --git a/app/gather_info.sh b/app/gather_info.sh index 82158cd..d33e83a 100755 --- a/app/gather_info.sh +++ b/app/gather_info.sh @@ -196,6 +196,9 @@ gather_container_stats() { [ -n "$uptime_s" ] && echo "uptime_seconds=$uptime_s" } +# Ensure sbin paths are available (not always in PATH for non-root users) +export PATH="$PATH:/usr/sbin:/usr/local/sbin:/sbin" + # Use sudo if available and needed (infmap user won't have direct access) _sudo() { if [ "$(id -u)" -eq 0 ]; then diff --git a/setup-remote.sh b/setup-remote.sh index 8e41cee..640a5b0 100755 --- a/setup-remote.sh +++ b/setup-remote.sh @@ -206,9 +206,18 @@ fi SUDOERS_FILE="/etc/sudoers.d/infmap" SUDO_CMDS="" -# Detect which hypervisor tools are present +# Detect which hypervisor tools are present (check common sbin paths too) for cmd in pct qm lxc virsh; do cmd_path=$(command -v "$cmd" 2>/dev/null) + # Also check sbin paths not always in PATH + if [ -z "$cmd_path" ]; then + for p in /usr/sbin/$cmd /usr/local/sbin/$cmd /sbin/$cmd; do + if [ -x "$p" ]; then + cmd_path="$p" + break + fi + done + fi if [ -n "$cmd_path" ]; then SUDO_CMDS="${SUDO_CMDS}${USERNAME} ALL=(root) NOPASSWD: ${cmd_path}\n" fi