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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-04 23:32:14  来源:igfitidea点击:

PostgreSQL without password prompt : .pgpass ignored

linuxpostgresqlscriptingadmin

提问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 .pgpassfile (the same used for 8.3), the right of /root/.pgpassare 0600but calling psql keep asking for a password.

我有一个正确的.pgpass文件(用于8.3一样),右边/root/.pgpass0600但调用的psql不断要求输入密码。

NB : the PGPASSFILEvariable is empty, so I assume that the .pgpassfile 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