1

I am trying to use autopostgresqlbackup on ubuntu on an ec2 instance. I can log in with psql on the command line and it is picking up my .pgpass file and everything looks fine. When I run 'sudo autopostgresqlbackup' it just hangs and my error file mentions it's waiting for a password for the postgres user.

Here's my config files and error log. I am using the ubuntu user and my /home/ubuntu/.pgpass file is setup with 0600 permissions. I'm guessing this has something to do with what user I am logged in with and what user to specify in the SU_USERNAME config line. Should I be setting SU_USERNAME=ubuntu? Any help here would be appreciated. Thanks.

/etc/default/autopostgresqlbackup

# ===============================
# === Debian specific options ===
#================================

# By default, on Debian systems, only 'postgres' user
# is allowed to access PostgreSQL databases without password.
# In order to dump databases we need to run pg_dump/psql
# commands as 'postgres' with su.
#
# The following setting has been added to workraound this issue.
# (if it is set to empty, 'su' usage will be disabled)
SU_USERNAME=postgres

#=====================================================================
# Set the following variables to your system needs
# (Detailed instructions below variables)
#=====================================================================

# Username to access the PostgreSQL server e.g. dbuser
USERNAME=postgres

# Password
# create a file $HOME/.pgpass containing a line like this
#   hostname:*:*:dbuser:dbpass
# replace hostname with the value of DBHOST and postgres with 
# the value of USERNAME

# Host name (or IP address) of PostgreSQL server e.g localhost
DBHOST=localhost

# List of DBNAMES for Daily/Weekly Backup e.g. "DB1 DB2 DB3"
DBNAMES="all"

/var/lib/autopostgresqlbackup/ERRORS_localhost-881271020.log

Password for user postgres: 
Session terminated, terminating shell... ...killed.

pg_hba.conf

local   all             postgres                                md5
local   all             all                                     md5
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
host        all         all      207.244.165.220/32        md5
host        all         all      207.244.173.30/32        md5
3
  • If your own user already has access to the database, why do you use sudo to run the script?
    – Jenny D
    Dec 1, 2014 at 14:32
  • Since the script needs to create directories in /var/lib/ I was getting permission denied errors. Dec 1, 2014 at 16:01
  • I just left the setting empty and it worked for me.
    – Anjan
    Jun 1, 2015 at 10:27

0

You must log in to answer this question.

Browse other questions tagged .