Windows supports mounting WebDAV shares as drives. WebDAV is a HTTP protocol for file access used by for example SharePoint.
1 |
net use Z: http://server/webdav /PERSISTENT:yes /USER:USER PASS |
It does however not support basic auth by default (basic auth sends password in cleartext, which is bad). It took me some troubleshooting to figure it out so I thought I’d share my results. You’ll probably need basic knowledge of setting up and troubleshooting Apache sites as I’ve left out some details. See this tutorial on setting up basic WebDAV. The following builds on this tutorial, but adds digest auth in addition. Note that to mount WebDAV on Windows Server you need Desktop Experience feature installed.
First enable digest auth module:
1 |
a2enmod auth_digest |
Create the first user:
1 |
htdigest -c /var/www/webdav/passwd.dav webdav USER |
And edit /etc/apache2/sites-available/default:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
NameVirtualHost * <VirtualHost *> ServerAdmin webmaster@localhost DocumentRoot /var/www/webdav/mounts <Directory /var/www/webdav/mounts> Options Indexes MultiViews AllowOverride None Order allow,deny allow from all </Directory> Alias /webdav /var/www/webdav/mounts <Location /webdav> DAV On DavDepthInfinity on #AuthType Basic AuthType Digest AuthName "webdav" AuthUserFile /var/www/webdav/passwd.dav AuthDigestDomain /var/www/webdav Require valid-user </Location> </VirtualHost> |
Optional: Under the mounts-folder I wanted to share some SMB shares. I also wanted to combine all shared (multiple disks) into a single folder. Note the file_mode and dir_mode if you want write access. You also need standard web permissions on the folders (same as for any website).
1 2 3 4 5 |
//10.0.0.10/pub1 /mnt/pub1 cifs username=XXX,password=XXX,umask=222 0 0 //10.0.0.10/pub2 /mnt/pub2 cifs username=XXX,password=XXX,umask=222 0 0 //10.0.0.10/pub3 /mnt/pub3 cifs username=XXX,password=XXX,umask=222 0 0 //10.0.0.10/pub_rw /var/www/webdav/mounts/pub_rw cifs username=XXX,password=XXX,file_mode=0676,dir_mode=0676,gid=www-data 0 0 mhddfs#/mnt/pub1,/mnt/pub2,/mnt/pub3 /var/www/webdav/mounts/pub fuse defaults,allow_other 0 0 |
To combine folders (last line) you need mhddfs installed: apt-get install mhddfs
Hi,
You mentioned Sharepoint initially, but then talked about Apache – does that mean Sharepoint works with basic auth?
Cheers,
Chris
PS I just noticed our internal sites are using http (not https) – wow.
The problem is client side (need client side registry patch to remove restriction), so I’m guessing its not using basic auth.
WebDAV is just the protocol and works on both IIS (SharePoint) and Apache.
Thanks for the clarification.