How to protect a web page with
If you happen to need to protect a web page but not only for LSC
usage, you need to perform the following steps:
- Create the directory to protect under your
WWW tree, e.g.
mkdir -p ~/WWW/PROTECT
- Create a file named
.htaccess in it with the following content (exchange your username accordingly)
AuthName "Files under this directory are protected, please enter credentials"
This will ask the web server to look into the file
(where I chose to place the password for this access). It will display the text after
once you try to access the directory/page. Also, it requires the use of https instead of the non-encrypted http transport.
- now use
pwgen 12 1 or similar tools (please don't do this on the web) to generate a nice password
- initially run
htpasswd -c /home/carsten/WWW-secrets/PROTECT Atlantis to create the user
Atlantis (case sensitive!) - it will ask for a password - enter the one you just generated
That's basically all, if you now surf to
there should be a password box popping up in which you should enter
and the password.
To add extra users, re-run the htpasswd command but omit
options as this will wipe out all existing users.
| Title || How to protect a web page with |
| Description || Using htaccess file to protect some directories from too nosy surfers |
| Tags || apache, htaccess |
| Category || User |