Linux 没有密码提示的 PostgreSQL : .pgpass 被忽略
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3837740/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PostgreSQL without password prompt : .pgpass ignored
提问by AsTeR
I'm trying to enable root (Ubuntu 8.04) to use psql command without password prompt (for scripting purpose). Everything worked fine with PostgreSQL 8.3, but I migrate to PostgreSQL 8.4 and the login without password doesn't work anymore.
我正在尝试启用 root (Ubuntu 8.04) 在没有密码提示的情况下使用 psql 命令(用于脚本目的)。在 PostgreSQL 8.3 上一切正常,但我迁移到 PostgreSQL 8.4 并且没有密码的登录不再有效。
I've a correct .pgpass
file (the same used for 8.3), the right of /root/.pgpass
are 0600
but calling psql keep asking for a password.
我有一个正确的.pgpass
文件(用于8.3一样),右边/root/.pgpass
是0600
但调用的psql不断要求输入密码。
NB : the PGPASSFILE
variable is empty, so I assume that the .pgpass
file is supposed to be used.
注意:PGPASSFILE
变量为空,所以我假设.pgpass
应该使用该文件。
Any brilliant idea?
有什么绝妙的主意吗?
采纳答案by Tometzky
Try to check if this works:
尝试检查这是否有效:
*:*:*:postgres:password_for_postgres_user
And then try:
然后尝试:
VERBOSITY=verbose psql --no-password --user postgres
This question should probably be migrated to serverfault.com.
这个问题可能应该迁移到serverfault.com。