Access WSL File Systems Read-Only from a Browser

In Windows, I opened an .html file in the Windows Subsystem for Linux (WSL) /tmp directory (corresponding to \\wsl.localhost\Ubuntu-20.04\tmp on Windows) and found something unexpected in the address bar: file://wsl.localhost/Ubuntu-20.04/ followed by the Unix file system path to the file.

Apparently, wsl.localhost works like a webserver with directory browsing enabled, from which you can access the various WSL implementations.

That sure is handy! Any directory is automatically a simple website. Useful for some rust docs I’m drafting.

If you try to access a Windows file system, such as C:\ (/mnt/c), you should receive an error.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: