0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Apache パスワードファイルを生成しようとするとエラーになる

Posted at

概要

  • ApacheにてBasic認証用パスワードファイルを生成しようとするとエラーになる問題を解決した。

エラーまでの経緯

  1. AWSのEC2でAmazonLinx2マシンを起動しApacheをインストールし起動した。

  2. 下記コマンドを実行してパスワードファイルの生成を試みた。

    $ sudo mkdir -p /usr/local/apache/passwd/passwords
    $ sudo htpasswd -c /usr/local/apache/passwd/passwords hogefuga
    

エラー

  1. 下記のエラーが出力されパスワードファイルの生成をする事ができない。

    htpasswd: cannot create file /usr/local/apache/passwd/passwords
    

解決までの経緯

  1. 原因は単純だった。

  2. パスワードファイル作成前にディレクトリを生成しているところで「passwords」というディレクトリを作ってしまっている。

  3. 次のコマンドで「/usr/local/apache/passwd」ディレクトリ直下に「passwords」というパスワードファイルを生成しようとしている。

  4. なので「/usr/local/apache/passwd」ディレクトリ直下に「passwords」がある状態でそれと同じ階層に「passwords」というパスワードファイルを生成する様に命令している。名前がかち合って後者のコマンドが実行できなかった。

  5. 「passwords」ディレクトリを削除し、パスワードファイルを再生成したらエラーは解消した。

    sudo rm -rf /usr/local/apache/passwd/passwords
    sudo htpasswd -c /usr/local/apache/passwd/passwords hogefuga
    

参考文献

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?