Error message concerning .pgpass on Linux
sethgoldin opened this issue · 4 comments
On Linux, upon running the centos-automate-workflow.sh
script with sudo
, the script seems to check for .pgpass
in the wrong spot, in /home/root/
, and throws the following error:
touch: cannot touch ‘/home/root/.pgpass’: No such file or directory
./centos-automate-workflow.sh: line 79: /home/root/.pgpass: No such file or directory
chmod: cannot access ‘/home/root/.pgpass’: No such file or directory
It might be unnecessary though, since the pg_hba.conf
file is already set up to just use trust
authentication.
Will see about completely eliminating the step for creating a .pgpass
file.
It looks like since the authentication method is trust
, the .pgpass
file is totally unnecessary here: https://www.postgresql.org/docs/9.5/static/auth-methods.html#AUTH-TRUST
Given that that these three lines use /home/$USER/.pgpass
and the script is being run with sudo
, I'm thinking that fixing this should be as simple as switching the code to /$HOME/.pgpass, so that it invokes the actual non-root user, even while using sudo
.
Bingo!