sethgoldin / davinci-resolve-postgresql-workflow-tools

Effortlessly set up automatic backups and automatic optimizations of DaVinci Resolve Studio's PostgreSQL databases
Other
80 stars 11 forks source link

Error message concerning .pgpass on Linux #12

Closed sethgoldin closed 6 years ago

sethgoldin commented 6 years ago

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.

sethgoldin commented 6 years ago

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

sethgoldin commented 6 years ago

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.

https://github.com/sethgoldin/davinci-resolve-postgresql-workflow-tools/blob/6bae260822e7a9715656b477b83486b34b71246f/centos-automate-workflow.sh#L77 https://github.com/sethgoldin/davinci-resolve-postgresql-workflow-tools/blob/6bae260822e7a9715656b477b83486b34b71246f/centos-automate-workflow.sh#L78 https://github.com/sethgoldin/davinci-resolve-postgresql-workflow-tools/blob/6bae260822e7a9715656b477b83486b34b71246f/centos-automate-workflow.sh#L79

sethgoldin commented 6 years ago

Also https://github.com/sethgoldin/davinci-resolve-postgresql-workflow-tools/blob/6bae260822e7a9715656b477b83486b34b71246f/centos-automate-workflow.sh#L81

sethgoldin commented 6 years ago

Bingo!