1

I have a script for setting up a test database (in a Web application) that populates the database with the COPY command running from a Postgres driver, not psql.

I read that Postgres will run that command as the postgres user.

But I get a 42501 error like this:

** (Postgrex.Error) ERROR 42501 (insufficient_privilege): could not open file "/home/rodrigo/xx/clients/xx/xx-v2/test/seed/profiles.csv" for reading: Permission denied

So I tried adding postgres to the group that owns all folders down to that csv (except for root). And here are the permissions and groups all the way down:

drwxr-xr-x root    root  /
drwxr-xr-x rodrigo users home
drwxr-xr-x rodrigo users rodrigo
drwxr-xr-x rodrigo users xx
drwxr-x--x rodrigo users clients
drwxr-x--x rodrigo users xx
drwxr-x--x rodrigo users siebert-v2
drwxr-xr-x rodrigo users test
drwxr-xr-x rodrigo users seed
-rwxr-xr-x rodrigo users profiles.csv

But I still get the same error. I thought that by adding postgres to the users group it would be able to read the files as shown above. Do I need to add it to the root group? Or make users own the / folder?

0 Answers0