Postgres - IDENT authentication failed
VMware上のFreeBSDで動作している影舞が遅いと言うので、情シスが提供してくれたRed Hat Enterprize Linux 3が動作しているPCに影舞をインストールすることにした。
このインストールする作業を行っているときに、マニュアル通りPostgresにkagemaiユーザを追加してもエラーが発生してしまった。
/var/log/httpd/error_log抜粋(以下は1行続き): /usr/local/lib/ruby/site_ruby/1.8/DBD/Pg/Pg.rb:111:in `initialize': FATAL: IDENT authentication failed for user "kagemai" (DBI::OperationalError)
試しに以下を実行しても同じエラーが発生した。
$ psql -U kagemai -W Password: psql: FATAL: IDENT authentication failed for user "kagemai"
そこで、"IDENT authentication failed"でGoogle検索を行ったところ、kagemai-users MLの情報を得ることが出来た。
結果として、/var/lib/pgsql/data/pg_hba.confを以下のように書き換えた。
TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD local all kagemai md5 # ←この行を追加 local all all ident sameuser
大切な点はident sameuser行の上に記入すること、Postgresを再起動することだ。
特に、ident sameuser行より下に記入しても、先にUSERのallに一致してしまうため意味が無くなるので注意が必要だ。