Make root log in as postgres user on PostgreSQL

I am writing some backup scripts for a server, and I needed a way to let the root user on the machine to login to PostgreSQL as 'postgres' user to perform some administrative operations.

To do so, I had to make a few changes to the configuration file, to let the root user to authenticate via local-socket without providing a password (the script is launched automatically by cron, no user interaction needed).

/etc/postgresql/8.3/main/pg_hba.conf:

# TYPE  DATABASE  USER      CIDR-ADDRESS  METHOD
local   all       postgres                ident rootaspg
local   all       all                     ident sameuser
host    all       all       127.0.0 ...

Page 1 / 1