6

Symbolic links are a widespread practice on linux to make a ressource (e.g. directory) available in another location without having to maintain several copies of it. This is implemented in many applications, e.g. having a ressources tree and a tree with user directories: Whenever a user is intended to work with a certain ressource, a symbolic link is placed into the directory he or she has access to. Given sufficient permissions, he or she can work with the ressource (create files in it) which may physically be written onto a different location, e.g. on a device with sufficient space. This works fine if the user accesses his home directory using Samba.

However, there are good reasons to work with WebDAV instead, port issues are one of them. The problem when porting such an application to WebDAV: Apache’s mod_dav is written in a way symbolic links are not exposed, no matter wether FollowSymLinks is set. This behaviour is intended by the communtiy, therefore a bug report was never tackled.

However, how can the desired behavior be ported to WebDAV? I tried to use hard links instead, but hard linking a directory seems not to work at all. Using mount might work, but I cannot estimate the side effect of hundreds of mounts. Is there an option I didn’t come over by now? Is there a known “best practice”? Or does WebDAV simply not fit as a replacement for Samba?

Matthias Ronge
  • 437
  • 1
  • 6
  • 17

2 Answers2

9

It seems to be that mount --bind is the solution I was looking for. There are reasons for and against the usage of ln -s vs mount --bind, but it seems to be common practice to mount a device several times on linux systems (even mounting single files onto other files is encouraged in man mount) and it seems that system stability isn’t seriously affected.

Only drawback is of course that, if mount points are not fixed by modifying /etc/fstab, they will get lost upon server restart.

One more word to WebDAV: There was an internet draft (which has expired meanwile) to extend the WebDAV specification in order to allow “advanced collections”, which should offer the capability of handling links, too. Work was spent on that question in about 1998—2002, then the toppic disappeared silently. You might find several pages on the internet claming that WebDav supports symbolic links by means of advanced collections, but currently, this is not the case. Current (v.1.0.3-1.3.6) mod_dav source code reads:

/* ### for now, only process regular files (e.g. skip symlinks) */
if (S_ISREG(fsctx->info1.finfo.st_mode)) {

One might expect that the Tomcat 6’s WebDAV module could be unaware of symbolic links (as, afaik, awareness of such file system special stuff wasn’t incorporated into the Java model before version 7), but it shows the same behaviour, thus conforming to the specification, too.

Last, a symlink patch for mod_dav-1.0.3-1.3.6 has been published, but you will have to apply the patch onto the source code and compile the module yourself … I didn’t try that.

Matthias Ronge
  • 437
  • 1
  • 6
  • 17
  • 1
    there is also a redirect specification ([RFC 4437](https://tools.ietf.org/html/rfc4437)), but unfortunately it seems hardly implemented. – DJCrashdummy Sep 03 '18 at 09:57
0

The DAV protocol does not follow sym links

So, use the apache config file to do the link instead.

On the file system

mkdir /www/public_html/somewhere-else

(i.e. so /somewhere-else shows up in the dav list-directory command)

In the apache config

Alias /somewhere-else /another-place

NB: If '/another-place' is outside the webserver , add to the apache config

<Directory /another-place>
Dav On
AllowOveride None # so .htaccess files are visible and their directives dont screw up dav
DirectoryIndex disabled # so dav's directory index command works
</Directory
Andrew Murphy
  • 161
  • 2
  • 5