3 ms·
Use apache to serve your page and htpasswd to provide basic authentication. Easy 1994 answer
by ipaddr 4y ago
Use apache to serve your page and htpasswd to provide basic authentication. Easy 1994 answer
- Gordonjcp 4y agoI thought that too, but this appears like it works to password protect an html file that's *not* being served off a server. This ought to work with a file on disk too.
- userbinator 4y agoThe more general solution is to use a password-protected archive.
- doodlesdev 4y agoBut then it's not self contained and every time you want to access the archive you also need a program that can decrypt/encrypt that format. Using a self-contained HTML file means it's currently the most portable way to encrypt something and have it available anywhere you can get the file on. By the way, I don't advocate for this idea. But still, I find it a pretty ingenious way to store encrypted data portably. Essentially what is happening is the file contains the encrypted data and the algorithm to decrypt it with the correct passphrase/key.
- chii 4y ago> you also need a program that can decrypt/encrypt that format that's just a self-extracting archive, which is a very common idea and easily created as well (very popular with both shareware distribution). The problem is that you have to trust the extracting code to not install anything else malicious. The browser provides the perfect sandbox - you cannot install malware into the system via javascript in the browser, and thus you can trust it to run.
- efreak 4y agoAnd you have to trust that running processes on dish aren't going to make a copy of it. Or that it won't end up stuck in the cache. This is (theoretically) only decrypted in memory (your browser may save a preview image of the tab, I believe Firefox mobile does this, not sure about desktop browsers)
- efreak 4y agoAlso, your self-extracting archive isn't platform independent, and likely can't be used at all on mobile platforms (iOS, Android) that don't offer to trying anyway files ootb (and are probably the wrong architecture anyways)
- mik1998 4y agoAlso NGINX auth basic option. I use it on my personal website. https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/ https://docs.nginx.com/nginx/admin-guide/security-controls/c...
- fIREpOK 4y agoDon't they all do? Lighttpd does: https://www.cyberciti.biz/tips/lighttpd-setup-a-password-protected-directory-directories.html https://www.cyberciti.biz/tips/lighttpd-setup-a-password-pro...