diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3a6d91b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+data
+user.passwd
+*~
+docker-compose.yml_off
+docker-compose.yml_priv
\ No newline at end of file
diff --git a/2.4/.gitignore b/2.4/.gitignore
new file mode 100644
index 0000000..e4e5f6c
--- /dev/null
+++ b/2.4/.gitignore
@@ -0,0 +1 @@
+*~
\ No newline at end of file
diff --git a/conf/conf-available/.gitignore b/conf/conf-available/.gitignore
new file mode 100644
index 0000000..f3e73ab
--- /dev/null
+++ b/conf/conf-available/.gitignore
@@ -0,0 +1,3 @@
+dav.conf_test
+dav.conf_user_block_
+test.sh
diff --git a/conf/conf-available/dav.conf_multi_user b/conf/conf-available/dav.conf_multi_user
new file mode 100644
index 0000000..39cc065
--- /dev/null
+++ b/conf/conf-available/dav.conf_multi_user
@@ -0,0 +1,45 @@
+DavLockDB "/var/lib/dav/DavLock"
+# transfer
+ Alias $Location/transfer "/var/lib/dav/data/transfer/"
+
+
+ Dav On
+ Options Indexes FollowSymLinks
+ IndexOptions Charset=UTF-8
+ DirectoryIndex disabled
+ IndexOptions FancyIndexing
+ IndexOptions HTMLTable
+ IndexOptions SuppressDescription
+ IndexOptions SuppressRules
+ IndexOptions NameWidth=*
+ IndexOrderDefault Ascending Name
+ IndexOptions IgnoreCase
+ IndexOptions FoldersFirst
+ IndexOptions VersionSort
+ AuthType Basic
+ AuthName "WebDAV"
+ AuthUserFile "/user.passwd"
+
+ Require valid-user
+
+
+
+
+ Require valid-user
+
+
+#placeholder_for_user_block
+
+# These disable redirects on non-GET requests for directories that
+# don't include the trailing slash (for misbehaving clients).
+BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
+BrowserMatch "^Microsoft-WebDAV-MiniRedir" redirect-carefully
+BrowserMatch "MS FrontPage" redirect-carefully
+BrowserMatch "^WebDrive" redirect-carefully
+BrowserMatch "^WebDAVFS/1.[01234]" redirect-carefully
+BrowserMatch "^gnome-vfs/1.0" redirect-carefully
+BrowserMatch "^XML Spy" redirect-carefully
+BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully
+BrowserMatch " Konqueror/4" redirect-carefully
+BrowserMatch "^gvfs" redirect-carefully
+BrowserMatch "^Jakarta-Commons-VFS" redirect-carefully
\ No newline at end of file
diff --git a/conf/conf-available/dav.conf b/conf/conf-available/dav.conf_single_user
similarity index 100%
rename from conf/conf-available/dav.conf
rename to conf/conf-available/dav.conf_single_user
diff --git a/conf/conf-available/dav.conf_user_block b/conf/conf-available/dav.conf_user_block
new file mode 100644
index 0000000..37f2237
--- /dev/null
+++ b/conf/conf-available/dav.conf_user_block
@@ -0,0 +1,30 @@
+# $user \
+ Alias $Location/$user "/var/lib/dav/data/$user/"\
+ \
+ \
+ Dav On\
+ Options Indexes FollowSymLinks\
+ IndexOptions Charset=UTF-8\
+ DirectoryIndex disabled\
+ IndexOptions FancyIndexing\
+ IndexOptions HTMLTable\
+ IndexOptions SuppressDescription\
+ IndexOptions SuppressRules\
+ IndexOptions NameWidth=*\
+ IndexOrderDefault Ascending Name\
+ IndexOptions IgnoreCase\
+ IndexOptions FoldersFirst\
+ IndexOptions VersionSort\
+ AuthType Basic\
+ AuthName "WebDAV"\
+ AuthUserFile "/user.passwd"\
+ \
+ Require valid-user \
+ \
+ \
+\
+ \
+ Require user $user\
+ \
+\
+\
\ No newline at end of file
diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh
index 5835895..4dbd582 100755
--- a/docker-entrypoint.sh
+++ b/docker-entrypoint.sh
@@ -19,6 +19,31 @@ HTTPD_PREFIX="${HTTPD_PREFIX:-/usr/local/apache2}"
PUID=${PUID:-1000}
PGID=${PGID:-1000}
+# decide between single user mode (no separate home directories) and
+# multi user mode (separate dedicated home directories and one shared transfer folder)
+
+if [ ! -e "/user.passwd" ]; then
+ cp "$HTTPD_PREFIX/conf/conf-available/dav.conf_single_user" "$HTTPD_PREFIX/conf/conf-available/dav.conf"
+# Configure dav.conf
+if [ "x$LOCATION" != "x" ]; then
+ sed -e "s|Alias .*|Alias $LOCATION /var/lib/dav/data/|" \
+ -i "$HTTPD_PREFIX/conf/conf-available/dav.conf"
+fi
+else
+ cp "$HTTPD_PREFIX/conf/conf-available/dav.conf_multi_user" "$HTTPD_PREFIX/conf/conf-available/dav.conf"
+cat /user.passwd | while read line
+do
+ user=$(echo -n $line|cut -d ":" -f 1)
+ mkdir -p "/var/lib/dav/data/$user"
+ user_block=$(cat $HTTPD_PREFIX/conf/conf-available/dav.conf_user_block)
+ user_block=$(echo "$user_block"|sed -e 's/\$user/'"$user"'/g')
+ sed 's!#placeholder_for_user_block!'"$user_block"'#placeholder_for_user_block!g' -i $HTTPD_PREFIX/conf/conf-available/dav.conf
+done
+sed -e 's|$Location|'"${LOCATION:-/}"'|g' \
+ -i "$HTTPD_PREFIX/conf/conf-available/dav.conf"
+
+fi
+
# Configure vhosts.
if [ "x$SERVER_NAMES" != "x" ]; then
# Use first domain as Apache ServerName.
@@ -32,11 +57,6 @@ if [ "x$SERVER_NAMES" != "x" ]; then
-i "$HTTPD_PREFIX"/conf/sites-available/default*.conf
fi
-# Configure dav.conf
-if [ "x$LOCATION" != "x" ]; then
- sed -e "s|Alias .*|Alias $LOCATION /var/lib/dav/data/|" \
- -i "$HTTPD_PREFIX/conf/conf-available/dav.conf"
-fi
if [ "x$REALM" != "x" ]; then
sed -e "s|AuthName .*|AuthName \"$REALM\"|" \
-i "$HTTPD_PREFIX/conf/conf-available/dav.conf"
@@ -113,8 +133,10 @@ sed -i -e "s|^Group .*|Group #$PGID|" "$HTTPD_PREFIX/conf/httpd.conf";
# Create directories for Dav data and lock database.
[ ! -d "/var/lib/dav/data" ] && mkdir -p "/var/lib/dav/data"
+[ ! -d "/var/lib/dav/data/transfer" ] && mkdir -p "/var/lib/dav/data/transfer"
[ ! -e "/var/lib/dav/DavLock" ] && touch "/var/lib/dav/DavLock"
chown $PUID:$PGID "/var/lib/dav/data"
+chown $PUID:$PGID "/var/lib/dav/data/transfer"
chown $PUID:$PGID "/var/lib/dav/DavLock"
# Set umask