From 20b822d0720fed970523957242e13e9ec784c6d0 Mon Sep 17 00:00:00 2001 From: HansAndreManfredson Date: Tue, 17 Jun 2025 22:08:32 +0200 Subject: [PATCH] Fix missing groups #892 (#893) --- supplemental/scripts/install-agent.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/supplemental/scripts/install-agent.sh b/supplemental/scripts/install-agent.sh index 50c566f..c45441c 100755 --- a/supplemental/scripts/install-agent.sh +++ b/supplemental/scripts/install-agent.sh @@ -316,18 +316,27 @@ fi # Create a dedicated user for the service if it doesn't exist if is_alpine; then if ! id -u beszel >/dev/null 2>&1; then + echo "Creating a dedicated group for the Beszel Agent service..." + addgroup beszel echo "Creating a dedicated user for the Beszel Agent service..." - adduser -S -D -H -s /sbin/nologin beszel + adduser -S -D -H -s /sbin/nologin -G beszel beszel fi - # Add the user to the docker group to allow access to the Docker socket - addgroup beszel docker + # Add the user to the docker group to allow access to the Docker socket if group docker exists + if getent group docker; then + echo "Adding besel to docker group" + usermod -aG docker beszel + fi + else if ! id -u beszel >/dev/null 2>&1; then echo "Creating a dedicated user for the Beszel Agent service..." useradd --system --home-dir /nonexistent --shell /bin/false beszel fi - # Add the user to the docker group to allow access to the Docker socket - usermod -aG docker beszel +# Add the user to the docker group to allow access to the Docker socket if group docker exists + if getent group docker; then + echo "Adding besel to docker group" + usermod -aG docker beszel + fi fi # Create the directory for the Beszel Agent