Skip to content

Commit

Permalink
feat(): use existing user group when possible (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
garethflowers authored Jan 9, 2025
1 parent 681f1e6 commit cf944a2
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions src/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
#!/bin/sh
FTP_DATA=/home/$FTP_USER
FTP_GROUP=$( getent group "$GID" | awk -F ':' '{print $1}' )

addgroup \
-g $GID \
-S \
$FTP_USER
if test -z "$FTP_GROUP"; then
FTP_GROUP=$FTP_USER
addgroup -g "$GID" -S "$FTP_GROUP"
fi

adduser \
-D \
-G $FTP_USER \
-h /home/$FTP_USER \
-s /bin/false \
-u $UID \
$FTP_USER
adduser -D -G "$FTP_GROUP" -h "$FTP_DATA" -s "/bin/false" -u "$UID" "$FTP_USER"

mkdir -p /home/$FTP_USER
chown -R $FTP_USER:$FTP_USER /home/$FTP_USER
mkdir -p $FTP_DATA
chown -R "$FTP_USER:$FTP_GROUP" "$FTP_DATA"
echo "$FTP_USER:$FTP_PASS" | /usr/sbin/chpasswd

sed -i -r "s/0.0.0.0/$PUBLIC_IP/g" /etc/vsftpd.conf
Expand Down

0 comments on commit cf944a2

Please sign in to comment.