当您尝试连接到Postgres时:
# psql -h localhost dgrt postgres
I get an error:
#User "postgres" has not passed authentication (Ident)
配置我的文件postgresql.conf:
listen_addresses = '*'
pg_hba.conf:
#Allow replication connections from localhost, by a user with the
#replication privilege.
host all all 127.0.0.1/32 ident
使用 ident
auth,您需要启动命令作为正确的OS用户,即数据库用户名必须匹配本地主机上的OS用户名。
例如(作为根)您可以做:
# su postgres -c 'psql dgrt'
与远程主机的连接相同。有关详细信息,请参阅文档。
供参考:
- https://www.postgresql.org/docs/9.3/static/auth-methods.html#auth-inent
- https://www.postgresql.org/docs/9.3/static/auth-pg-hba-conf.html
- http://man7.org/linux/man-pages/man1/su.1.html