9

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.

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.

NB : the PGPASSFILE variable is empty, so I assume that the .pgpass file is supposed to be used.

Any brilliant idea?

3
  • "strace -o <log_file> psql ... " and then look into the log file for ".pgpass". Commented Oct 1, 2010 at 10:02
  • Here are the lines containing .pgpass into the log file stat("/root/.pgpass", {st_mode=S_IFREG|0600, st_size=37, ...}) = 0 open("/root/.pgpass", O_RDONLY) = 3 stat("/root/.pgpass", {st_mode=S_IFREG|0600, st_size=37, ...}) = 0 open("/root/.pgpass", O_RDONLY) = 3 Commented Oct 1, 2010 at 11:32
  • I've also a line showing that pgsql found the password : read(3, "localhost:5432:dbname:usrname:passw"…, 4096) = 37 Commented Oct 1, 2010 at 11:35

1 Answer 1

14

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.

Sign up to request clarification or add additional context in comments.

1 Comment

You are right it's more a server administration problem. The problem was that the server was installed right after postgres 8.3 and thus the installation make it run on the port 5433 instead of 5432. I fixed it by editing postgres.conf. Thanks !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.