autopostgresqlbackup postgres 身份验证错误

autopostgresqlbackup postgres 身份验证错误

我正在尝试在 ec2 实例上的 ubuntu 上使用 autopostgresqlbackup。我可以在命令行上使用 psql 登录,它会拾取我的 .pgpass 文件,一切看起来都很好。当我运行“sudo autopostgresqlbackup”时,它只是挂起,我的错误文件提到它正在等待 postgres 用户的密码。

这是我的配置文件和错误日志。我使用的是 ubuntu 用户,我的 /home/ubuntu/.pgpass 文件设置了 0600 权限。我猜这与我以哪个用户身份登录以及在 SU_USERNAME 配置行中指定哪个用户有关。我应该设置 SU_USERNAME=ubuntu 吗?如能得到任何帮助,我将不胜感激。谢谢。

/etc/default/autopostgresql备份

# ===============================
# === 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.

配置文件

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

相关内容