Rafael Barrera Oro <borafael(at)gmail(dot)com> wrote:
> I've "inherited" a pgsql database (in linux server, already
> configured and set up) and i noticed that the root user can access
> a particular database without being prompted for password (using
> the psql command).
>
> I assume it's something related to database ownership and user
> permissions but i can't find exactly what is causing this.
>
> I'd like to replicate this behaviour for other database since my
> goal is to use the root user for executing cron task (where a
> password prompts is highly annoying)
That's probably because of the configuration in the pg_hba.conf
file:
http://www.postgresql.org/docs/current/interactive/auth-pg-hba-conf.html
or maybe the .pgpass file:
http://www.postgresql.org/docs/current/interactive/libpq-pgpass.html
By the way, I would seriously consider setting this for a "database
superuser" login related to an OS login which owns the database,
rather than the root account. Using root anytime it's not
absolutely necessary is generally not good practice.
-Kevin