I will be password protecting /home/droidozo/public_html/wiki
Create a file .htaccess in the same directory:
[/home/droidozo]# cat /home/droidozo/www/wiki/.htaccess AuthType Basic AuthName "moodle" AuthUserFile "/home/droidozo/.htpasswds/public_html/wiki/passwd" require valid-user
Here, moodle is the name that appears in the pop up where you are prompted for a password.
Now create the folder structure for the directory containing password, which is not accessible on the server by public.
mkdir -p /home/droidozo/.htpasswds/public_html/wiki
Change to this directory, and:
First create the password file, with one user:
htpasswd -c .htpasswd user1
At this point, you will be asked for a password for user user1. A new password file will be created, containing:
The hashed password differs depending on your password.
Create the password file:
cat /home/droidozo/.htpasswds/public_html/wiki/passwd userme:$apr1$TBkGAByI$5W2J7BJPKRvJyCEVuT53e/
Joel G Mathew, known in tech circles by the pseudonym Droidzone, is an opensource and programming enthusiast.
His favorite pastime is grappling with GNU compilers, discovering newer Linux secrets, writing scripts, hacking roms, and programs (nothing illegal), reading, blogging. and testing out the latest gadgets.
When away from the tech world, Dr Joel G. Mathew is a practising ENT Surgeon, busy with surgeries and clinical practise.