Skip to content

Instantly share code, notes, and snippets.

@ozuma
Last active December 17, 2015 19:19
Show Gist options
  • Save ozuma/5659786 to your computer and use it in GitHub Desktop.
Save ozuma/5659786 to your computer and use it in GitHub Desktop.
Create Apache htpasswd (encoded with MD5/SHA1)
# Create File
## Default
$ htpasswd -c .htpasswd guest
$ htpasswd -d -c .htpasswd guest # 最近のは-dが必要
# cryptはパスワード8文字
New password:
Re-type new password:
Adding password for user guest
$ cat .htpasswd
guest:AB5mCJkOABnpY
## MD5
$ htpasswd -m -c .htpasswd guest
New password:
Re-type new password:
Adding password for user guest
$ cat .htpasswd
guest:$apr1$...../..$O4..../..............1
## SHA
$ htpasswd -s -c .htpasswd guest
New password:
Re-type new password:
Adding password for user guest
$ cat .htpasswd
guest:{SHA}NWd..............Q/E......A=
# Print
$ htpasswd -s -n guest
New password:
Re-type new password:
guest:{SHA}NWd..............Q/E......A=
$ vi .htpasswd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment