17 February 2015

Create or generate .htpasswd file from command line in Linux. The file is used for password protected websites in Apache. The easiest way to create one is to generate it from terminal.

Source code viewer
  1. # Create new file, and add a user into it. The password will be prompted.
  2. htpasswd -c /var/www/.htpasswd USERNAME
  3.  
  4. # Add or update password. The logic is same, password will be prompted.
  5. htpasswd /var/www/.htpasswd USERNAME
Programming Language: Apache configuration