From 155cbf4efdf60fed7b2af52b064409156fcf3c44 Mon Sep 17 00:00:00 2001 From: Brendan DeBeasi Date: Wed, 21 Jan 2026 12:32:07 -0800 Subject: [PATCH] fix: use exact match for USER_NAME in /etc/passwd check The grep pattern `^${USER_NAME}` incorrectly matches usernames that are prefixes of existing users. For example, USER_NAME=b matches the 'bin' user, causing the container to halt with a false positive. Adding a colon after USER_NAME ensures exact username matching: `^${USER_NAME}:` only matches the exact username field. closes #118 --- root/etc/s6-overlay/s6-rc.d/init-adduser/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/root/etc/s6-overlay/s6-rc.d/init-adduser/run b/root/etc/s6-overlay/s6-rc.d/init-adduser/run index 7bc467e..7e3ea09 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-adduser/run +++ b/root/etc/s6-overlay/s6-rc.d/init-adduser/run @@ -1,7 +1,7 @@ #!/usr/bin/with-contenv bash # shellcheck shell=bash -if [[ ! -f "/usermod.done" ]] && [[ -n "${USER_NAME}" ]] && [[ "${USER_NAME}" != "abc" ]] && grep -q "^${USER_NAME}" /etc/passwd; then +if [[ ! -f "/usermod.done" ]] && [[ -n "${USER_NAME}" ]] && [[ "${USER_NAME}" != "abc" ]] && grep -q "^${USER_NAME}:" /etc/passwd; then echo "*** USER_NAME cannot be set to an user that already exists in /etc/passwd. Halting init. ***" sleep infinity else