2009/10/19

Access your home files from anywhere via browser and webdav (https) disk

This weekend I fiddled with enabling access to my home fileserver. I already can access it via RDP (Windows7) and FreeNX (fastest, recommended remote access with Ubuntu/Linux). I also manage my torrents with uTorrent's webUI. Files are accessible on home network via Windows files sharing (SMB on Windows/Samba on Linux).

My goal for the weekend was to enable remote access to files from anywhere on internet, under both Windows and Linux, with secure password protection.  For this purpose, I use webdav sharing with SSL (self-signed certificate) on my server. It can be raised on Apache2 (free on both Windows and Linux) and on IIS (free from Microsoft only on Windows).

Choosing server
I killed couple of hours raising apache2 on Ubuntu, but ultimately failed forcing it to use SSL. (meh, will try later) and then I tried apache2 on Windows - and this is utterly pervert feeling to configure it in CLI on Windows. Will try to avoid at any cost in the future. Luckily, there is free web server from Microsoft, IIS 7. It probably has some limits that would make it unsuitable for large website hosting, but it is perfectly Ok for my purposes. So, I installed IIS7 and enabled WebDAV.

IIS7/WebDAV Configuration (sorry, this is not a full manual explaining where to click each time, rather a milestone walkthrough for me or someone already familiar with IIS7 interface. I am saving it here, to read again should I ever need to repeat this procedure)

First, create self signed certificate. Add it to default websiite.
Bind website to your own domain. I do not have fixed IP, so I use dynamic dns service for dns resolution. So, I bind default website in IIS to my dynamic dns: solnyshok.dyndns.info
Then limit protocols to SSL (port 443).
Authorization method = application passthrough.
Enable WebDav module.
Enable Basic Authetication.
Enable Authorization for specific user.
Enable SSL = required
Create Authoring Rule for WebDav (* allow for all users)
Enable "Directory browsing" if you want to browse your folders in your web browser. This is not related to WebDAV, but rather is an additional extra, for getting access to your files on any computer wherever you are, with just a browser and a password.
Add virtual directory (directories) pointing to the folder (NOT DRIVE!!!) that you want to share. Check that authentication setting, authoring rules, filtering, directory browsing, ssl setting have been inherited.

Notes to myself
1. User "Network Service" and "IIS*" should have access to the destination folders or it fails to access it.
2. Drive root (at least on my Windows 7 system) contains protected system folders that IIS will fail to open, resulting in failure to show content of the root of the drive. (so, https://mywebsite.com/drive1tb fails to open, but https://mywebsite.com/drive1tb/subfolder opens ok)
3. If you want to be able to access certain files that are not listed in the MIME-types module, you can't. Need to add to MIME type list first.

Accessing remote WebDAV drive on
To connect to webdav shares on needs to map network drive in windows (https://solnyshok.dyndns.info) or connect to network share with SecureWebDav (davs://solnyshok.dyndns.info) in Ubuntu (9.10, Karmic Koala beta). You will be asked  username/password on first access. Update: I have run into problems with Windows, seems that Windows7 network drive mapper prevents connection to a server with self-signed certificate, and there is no way to override this behaviour. :(



And here is how it looks in web browser (if Directory Browsing module is enabled).


Technorati Tags: , , , , ,





Reblog this post [with Zemanta]

No comments:

Post a Comment