19

I have a machine on which I wish to mount multiple remote servers to access them all centrally. For remote Linux based systems I am using SSHFS which works fine. But for Windows systems, or systems without SSH, they all have some form of HTTP server installed sharing the files (so they all have directory browsing enabled).

Can I mount a HTTP server as a local file system like SSHFS, so I can have all these remote servers mounted locally and presented in a uniform manner?

7
  • 1
    Someone out there might have written a tool to simulate this but I doubt it. The way that HTTP servers typically present the information is not very conducive to it. Commented Mar 11, 2013 at 14:54
  • As above. Also the HTTP browsing is just that - it browses and reads, doesn't support uploading. I would look at either sharing the folder(s) to mount either via SMB/CIFS or FTP. Alternatively look at WebDAV and I'm sure you can find a IIS implementation. Commented Mar 11, 2013 at 15:15
  • 2
    @goldilocks someone out there made it a standard well over 10 years ago. Commented Mar 11, 2013 at 15:21
  • Live and learn. :) Commented Mar 11, 2013 at 15:28
  • 1
    @DaveC Well typically directory browsing doesn't support uploading, however I failed to mention that I wanted read only access. Although HTTP it's self does support uploading with the PUT method. Commented Mar 11, 2013 at 20:07

5 Answers 5

11

You can do this using WebDAV. This is an HTTP extension that is supported by most web servers, including IIS and Apache. WebDAV can be mounted in linux via the davfs2 FUSE module.

3
  • 2
    davfs2... or fusedav or avfs or gvfs (Gnome/Nautilus) at least. Commented Mar 11, 2013 at 20:11
  • 1
    There's also cadaver on Linux that can do that. Commented Jul 15, 2022 at 13:51
  • I tried cadaver with a WebDAV client, and it worked, but it didn't allow me to use my local machine's programs on the files from the server. I was hoping to have a WebDAV server on my desktop and stream music from it to my Android tablet with mpv on Termux via the cadaver client's mount (but there's no access to mpv installed on Termux). Commented Jul 22, 2022 at 11:38
6

The problem with plain HTTP is that its just for retrieving content. There's no concept of folder or file list.

Some web servers let you browse directory structures by generating nice HTML pages with links to files for directories. And at least things like lftp are able to parse some of the common formats those indexes are generated as and give you the impression that it is a file transfer protocol, but it's not really, and I don't know of any fuse file systems that can parse indexes the way lftp does.

DAV is an extension that just does that and is already covered by jordanm's answer.

But note that if you don't need to list directories, avfs at least can let you access web pages over the filesystem.

$ mkdir AVFS $ avfsd AVFS $ grep -w Reputation 'AVFS/#http:unix.stackexchange.com|users|12583|javano' <span class="count">731</span> Reputation 

Now also note that you can install sshd (via cygwin) or a FTP or Apache with DAV on a Windows machine as well, so you should be able to do the same things as you do on Unix machines.

2
  • wouldn't the path portion of an HTTP URL be considered as corresponding to a directory structure under the root? also, many web servers offer a file listing if you request a URL ending with a directory, not a file. and then both of these two concepts could be translated into this model of mounting an HTTP server as a file system. now, as far as posting changes to such a mount, I am not sure about that but perhaps some web servers could be configured to do it much like FTP Commented Mar 11, 2013 at 21:37
  • @amphibient, yes, what you call a file listing is what I call a generated HTML page with links to file. It still needs to be parsed and there's no standard on the format of those pages. On Apache alone there are several modules generating those indexes which can be tuned in many different ways. So there's no foolproof solution. As I said see lftp that tries to parse many of those listing pages. Commented Mar 11, 2013 at 21:44
2

httpdirfs can help

example: start an HTTP server with

python -m http.server & # http://localhost:8000/ 

... and mount the root path (/) with

mkdir mnt httpdirfs http://localhost:8000/ mnt 
1

the main issue already covered above is: directory/tree listing.

Although your question is quite old and you might have done otherwise, I have recently written a fuse filesystem that does exactly what you need, provided you write a little script to give it the "tree" of URLs.

It is there : https://gitlab.com/BylonAkila/astreamfs

You have an example script for the provider 1fichier, which you can adapt to your own personal server. What the script does is only prepare all the arguments for astreamfs, so that the mount will show all your files and folders in the right place. It does so with the (in)famous "web scraping" technique, aka reading HTML pages and extracting relevant parts from that.

There are still two major constaints, obviously, compared to regular mounts like NFS or SSHFS:

  • The http server needs to handle 'ranges' (most servers can do that)
  • It is read-only!
1

Stéphane's answer already states, you can’t modify or upload files without WebDAV. If you don’t need write access, you can use rclone and its http remote.

$ rclone config create foo http url=http://foo.bar/baz 

where foo is the name of your remote and http is the type of your remote and url is the url of the webserver you want to add as a remote. You can add multiple remotes.

mounting your remote is also possible using rclone

$ rclone mount foo: /some/path/on/your/system 

rclone also supports WebDAV in case you need to upload or modify, this can also be configured as a remote.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.