2

Here I want to protect a directory of a website which require a username and password to access..

I created .htaccess file in same directory..

 AuthName "Member's Area Name"
 AuthUserFile /path/to/password/file/.htpasswd
 AuthType Basic
 require valid-user

and here my .htpasswd file in the same directory

username:encryptedpassword
fred_smith:oCF9Pam/MXJg2

So my problem is how to setup my own custom password in the above field 'encryptedpassord' as I read we cannot just make up the password, on Unix/Linux servers they must be encrypted by the server, on Windows servers you do just use a plain text password as Windows does not offer any encryption methods

IS THERE ANY METHOD TO SET OWN CUSTOM PASSWORD?

Anshuman Singh
  • 1,134
  • 1
  • 13
  • 21
  • This question is answered here. http://stackoverflow.com/questions/5229656/password-protecting-a-directory-and-all-of-its-subfolders-using-htaccess/43831765#43831765 – Deepak R May 13 '17 at 18:27

1 Answers1

3

You can just use htpasswd command to create a new entry in that file.

htpasswd /path/to/password/file/.htpasswd john

will ask you for the password of john, then will create a user entry for it.

Özgür Eroğlu
  • 1,230
  • 10
  • 16