Hello!

I'm working on adding WebDAV access to the directories already accessible via FTP. The layout is fairly simple: the /data/ftp tree houses the "home" directories of FTP's (virtual) users. I wanted to give the HTTP users the same experience they get via FTP -- they must login, and then their top-level directory will be /data/ftp//USERNAME/. No user should see the full listing of users, nor be able to get into another user's subtree even by guessing the other username.

To this end I set up the configuration as follows:

   DocumentRoot "/data/ftp"

   <Directory /data/ftp>

       AuthType Basic
       AuthName "Foo File-Server"
       Require    valid-user
       AuthUserFile /somewhere/passwd

       RewriteEngine    on
       # Without the below condition, the rewrite rule keeps rewriting
       # until "Internal Error". A mystery...
       RewriteCond    %{ENV:REDIRECT_STATUS}    !200
RewriteRule (.*) %{REMOTE_USER}/$1 [L]
   </Directory>

   <Directory  /data/ftp/*>

DAV on </Directory> This almost works -- upon going to the site (say, https://ftp.example.com/), the user is asked to login. He is then served the content of /data/ftp//USERNAME/, which appears as the top-level directory in the browser... Great...

However, for some reason, when a DAV-capable client is used (checked with cadaver and konqueror), a user "wallaby" sees not only the content of /data/ftp/wallaby, but also an entry (a "collection") named "wallaby", which is not really there on the server at all (there is no /data/ftp/wallaby/wallaby). Trying to access that phantom collection results in an error...

The questions:

  1. How do I eliminate the phantom entry from the otherwise perfect
     listing? Is its appearance a manifestation of a bug in mod_dav?
  2. Is it possible to achieve the same effect (DocumentRoot based on
     REMOTE_USER) without mod_rewrite?
  3. If the answer to 2. is "no", is there a better way to express what
     I want, than the two statements I came up with? In particular,
     without the check for REDIRECT_STATUS, I see (in mod_rewrite's
     log) continuing rewrites to
     /data/ftp/wallaby/wallaby/wallaby/..../wallaby -- until it gives
     up and throws a 500...

Thank you very much for any hints. Yours,

   -mi

Reply via email to