docker-tftp/init.sh/init.sh

24 lines
No EOL
572 B
Bash

#!/bin/bash
# Configure user and group IDs
PUID=${PUID:-1000}
PGID=${PGID:-1000}
echo "[init] Setting up user nbxyz with PUID=${PUID} and PGID=${PGID}"
if ! getent group ${PGID} > /dev/null 2>&1; then
addgroup --gid ${PGID} tftp
else
echo "[init] Group with GID ${PGID} already exists"
fi
if ! getent passwd ${PUID} > /dev/null 2>&1; then
adduser -u ${PUID} -G tftp -h /tftp -s /bin/false -D tftp
else
echo "[init] User with UID ${PUID} already exists"
fi
usermod -a -G users tftp 2>/dev/null || true
chown -R nbxyz:nbxyz /tftp
chmod -R 7777 -R /tftp