Getting Permission denied when trying to import .sql file with \i

Is there a way I can make it so the postgres user on my os has permission to run files owned by other users

The only permission needed is to read the file, and traverse the directory tree to get to the file. These can be set with chmod

make it so I can run psql from my linux user account rather than having to switch to the postgres user?

There are many options. If your current pg_hba local setting is just local all all peer, then add a new database superuser which is named the same as your linux account name. Or Change pg_hba.conf so you are using md5 (or trust, or scram-sha-256, or something fancier), rather than peer. Or keep using peer, but provide a user map and edit pg_ident.conf to allow your linux user to connect.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top