diff --git a/README.md b/README.md index 2e0d69c..1da864a 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,8 @@ The following environment variables are accepted. requires a hashed password such as the ones created with `mkpasswd -m sha-512` which is in the _whois_ debian package. +- `FTP_USER_*`: Adds mutliple users. Value must be in the form of `username:hash`. Should not be used in conjunction with `FTP_USER` and `FTP_PASSWORD(_HASH)`. + ## Usage Example ``` diff --git a/entry.sh b/entry.sh index acace32..a9ee751 100755 --- a/entry.sh +++ b/entry.sh @@ -13,6 +13,13 @@ if [ ! -z "$FTP_USER" -a ! -z "$FTP_PASSWORD_HASH" ]; then /add-virtual-user.sh -d "$FTP_USER" "$FTP_PASSWORD_HASH" fi +# Support multiple users +while read user; do + IFS=: read name pass <<< ${!user} + echo "Adding user $name" + /add-virtual-user.sh "$name" "$pass" +done < <(env | grep "FTP_USER_" | sed 's/^\(FTP_USER_[a-zA-Z0-9]*\)=.*/\1/') + function vsftpd_stop { echo "Received SIGINT or SIGTERM. Shutting down vsftpd" # Get PID @@ -34,4 +41,4 @@ if [ "$1" == "vsftpd" ]; then wait "${pid}" && exit $? else exec "$@" -fi \ No newline at end of file +fi