Subscribed unsubscribe Subscribe Subscribe

目の前に僕らの道がある

勉強会とか、技術的にはまったことのメモ

apache認証ファイル作成

忘れがちな脳のための覚え書き

ベーシック認証

  • -c
    • 新規作成
  • -m
    • MD5で暗号化
  • -s
  • -p
    • プレーンテキストで保存
  • -D
    • ユーザ削除
htpasswd [-c] <filename> <usename> 
masasuzu@leon% htpasswd -c .htpasswd hoge                             [~]
New password:
Re-type new password:
Adding password for user hoge
masasuzu@leon% htpasswd -m .htpasswd fuga                             [~]
New password:
Re-type new password:
Adding password for user fuga
masasuzu@leon% htpasswd -s .htpasswd foo                              [~]
New password:
Re-type new password:
Adding password for user foo
masasuzu@leon% cat .htpasswd                                          [~]
hoge:2UWhgCRzj4KVQ
fuga:$apr1$85N6pGfv$G2AgMEj0qtTauVbTT4U0R/
foo:{SHA}C+7Hteo/D9vJXQ3UfzxbwnXaijM=

ダイジェスト認証

  • -c
    • 新規作成
htdigest [-c] <filename> <realm> <usename>
masasuzu@leon% htdigest -c .htdigest hoge masasuzu                    [~]
Adding password for masasuzu in realm hoge.
New password:
Re-type new password:
masasuzu@leon% cat .htdigest                                          [~]
masasuzu:hoge:e9d9b3953e80f2c1e44988d79a38a1fb
masasuzu@leon% htdigest .htdigest fuga masasuzu                       [~]
Adding user masasuzu in realm fuga
New password:
Re-type new password:
masasuzu@leon% cat .htdigest                                          [~]
masasuzu:hoge:e9d9b3953e80f2c1e44988d79a38a1fb
masasuzu:fuga:b5f306aaec1347724720b167abf46320
masasuzu@leon%