Skip to content

Instantly share code, notes, and snippets.

@jachin
Last active September 29, 2015 22:38
Show Gist options
  • Save jachin/1680254 to your computer and use it in GitHub Desktop.
Save jachin/1680254 to your computer and use it in GitHub Desktop.
htpasswd reference
# This is a command line too for apache's basic authentication management.
# CAUTION: make sure /some/path/to/a/file/named/htpasswd is outside of any directory inside the web root.
# To initially create the password
htpasswd -c /some/path/to/a/file/named/htpasswd initialUsername
# To add another user to the same file
htpasswd /some/path/to/a/file/named/htpasswd newUsername
# To change an existing user's password
htpasswd /some/path/to/a/file/named/htpasswd existingUsername
# Add the following to an .htaccess file to protect that directory
AuthName "Private zone"
AuthType Basic
AuthUserFile /some/path/to/a/file/named/htpasswd
require valid-user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment