BASIC認証、ダイジェスト認証

.htpasswdファイル作成

$ sudo htpasswd -c /etc/httpd/.htpasswd [ユーザー名]
$ sudo htpasswd -c /etc/httpd/.htpasswd test_user
New password: 
Re-type new password: 
Adding password for user test_user
  • ユーザーを追加する場合は、"-c"オプションを使用しない
$ sudo htpasswd /etc/httpd/.htpasswd [ユーザー名]

htdigestファイル作成

  • [AuthName]の部分は設定ファイルの AuthName と合わせる必要がある。
$ sudo htdigest -c /etc/httpd/.htdigest '[AuthName]' test_user
Adding password for test_user in realm [AuthName].
New password: 
Re-type new password: 
$ sudo htdigest -c /etc/httpd/.htdigest 'Authentication' test_user
  • 二人目以降
    • 「-c」のオプションを付けない。
$ sudo htdigest /etc/httpd/.htdigest '[AuthName]' test_user2