Skip to content

Commit 7129809

Browse files
committed
Don't allow USER_NAME to be set to existing user
1 parent 8e4cd2e commit 7129809

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

  • root/etc/s6-overlay/s6-rc.d/init-adduser

root/etc/s6-overlay/s6-rc.d/init-adduser/run

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
#!/usr/bin/with-contenv bash
22
# shellcheck shell=bash
33

4-
USER_NAME=${USER_NAME:-linuxserver.io}
4+
if grep -q "^${USER_NAME}" /etc/passwd; then
5+
echo "*** USER_NAME cannot be set to an user that already exists in /etc/passwd. Halting init. ***"
6+
sleep infinity
7+
else
8+
USER_NAME=${USER_NAME:-linuxserver.io}
9+
fi
510

611
PUID=${PUID:-911}
712
PGID=${PGID:-911}

0 commit comments

Comments
 (0)