Password protect a folder in xampp

Here is how to protect a folder with username and password in xampp :

  1. Open the command promote
  2. Go to your xampp folder and then go to: /apache/bin/
  3. Run this command :

    htpasswd.exe -c -b .htpasswd my_user _name my_password

    Don’t forget Change “my_user_name” and “my_password”
  4. A file with the name of .htpasswd will be created at the folder of /apache/bin
  5. Create a file with the name of : .htaccess at the folder you want to protect ( don’t forget the dot in .htaccess)
  6. Write the following in the .htaccess file:

    AuthType Basic
    AuthName “v3d”
    AuthUserFile “c:/xampp/apache/bin/.htpasswd”
    require valid-user


    Note that the path in AuthUserFile line (c:/xampp/apache/bin/.htpasswd) is the path to your xampp folder where the .htpasswd file is created, very important to keep this file away from the httdocs folder.

How to solve “gpg: public key decryption failed: Bad passphrase” in batch file

If you are trying to decrypt a file or a bunch of files using batch file in windows you will write something like this:

gpg --pinentry-mode=loopback --batch --yes --passphrase "abc%123" --decrypt-files *.pgp

and you put the above code in a .bat file and run it but you got an error like:

gpg: public key decryption failed: Bad passphrase

You are 1000% sure the passphrase is correct .. well the problem is in the passphrase itself as it contains a special character that needs to be escaped .. in the above example , the passphrase : “abc%123” must be written like this: “abc%%123” as %% is the escape of % … for a complete list of batch file escape characters , check this link

in case if you are wondering about the meaning of
–pinentry-mode=loopback¬†¬†
it is used to prevent the gui from pooping up and asking for the passphrase.

Another important point , to make the batch option work without problem .. you have to make sure that the encrypted file extensions is *.pgp