Add multiple user support
This commit is contained in:
@@ -25,6 +25,8 @@ The following environment variables are accepted.
|
|||||||
requires a hashed password such as the ones created with `mkpasswd -m sha-512`
|
requires a hashed password such as the ones created with `mkpasswd -m sha-512`
|
||||||
which is in the _whois_ debian package.
|
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
|
## Usage Example
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
7
entry.sh
7
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"
|
/add-virtual-user.sh -d "$FTP_USER" "$FTP_PASSWORD_HASH"
|
||||||
fi
|
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 {
|
function vsftpd_stop {
|
||||||
echo "Received SIGINT or SIGTERM. Shutting down vsftpd"
|
echo "Received SIGINT or SIGTERM. Shutting down vsftpd"
|
||||||
# Get PID
|
# Get PID
|
||||||
|
|||||||
Reference in New Issue
Block a user