Add multiple user support

This commit is contained in:
Tim Robinson
2015-12-17 11:29:40 +11:00
parent 387ecd2865
commit 2e88b706bb
2 changed files with 10 additions and 1 deletions

View File

@@ -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
```

View File

@@ -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