From 0d5942cfe30d6601dea65ea9ea87dccde32b0d3a Mon Sep 17 00:00:00 2001 From: Tim Robinson Date: Thu, 17 Dec 2015 11:39:31 +1100 Subject: [PATCH] Add local_root user support --- README.md | 2 ++ entry.sh | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/README.md b/README.md index 1da864a..f6aab85 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,8 @@ 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)`. +- `FTP_USERS_ROOT`: sets `local_root=/srv/$USER` so each user is chrooted to their own directory instead of a shared one. + ## Usage Example ``` diff --git a/entry.sh b/entry.sh index a9ee751..9459881 100755 --- a/entry.sh +++ b/entry.sh @@ -20,6 +20,11 @@ while read user; do /add-virtual-user.sh "$name" "$pass" done < <(env | grep "FTP_USER_" | sed 's/^\(FTP_USER_[a-zA-Z0-9]*\)=.*/\1/') +# Support user directories +if [ ! -z "$FTP_USERS_ROOT" ]; then + sed -i 's/local_root=.*/local_root=\/srv\/$USER/' /etc/vsftpd*.conf +fi + function vsftpd_stop { echo "Received SIGINT or SIGTERM. Shutting down vsftpd" # Get PID