When trying to run a SQL script using psql I am getting permission denied error.
Steps followed -
- opened up normal Bash interactive shell
- Ran the command as below
sudo -u postgres -s /bin/bash
- tried running the below pgsql - I provided the read write access to the pega folder; what else needs to be done to move the pgsql file to postgres library.
/Library/PostgreSQL/12/bin/psql -U dbusername dbpassword </Users/rr/Documents/pega/pega8db.pgsql
got the below error
bash: /Users/rr/Documents/pega/pega8db.pgsql: Permission denied
Result from Ps -ef
502 129 1 0 8:07AM ?? 0:00.09 /Library/PostgreSQL/12/bin/postmaster -D/Library/PostgreSQL/12/data
502 281 129 0 8:07AM ?? 0:00.00 postgres: logger
502 283 129 0 8:07AM ?? 0:00.01 postgres: checkpointer
502 284 129 0 8:07AM ?? 0:00.04 postgres: background writer
502 285 129 0 8:07AM ?? 0:00.02 postgres: walwriter
502 286 129 0 8:07AM ?? 0:00.04 postgres: autovacuum launcher
502 287 129 0 8:07AM ?? 0:00.18 postgres: stats collector
502 288 129 0 8:07AM ?? 0:00.00 postgres: logical replication launcher
501 942 1 0 8:29AM ?? 0:11.47 /Library/PostgreSQL/12/pgAdmin 4.app/Contents/MacOS/pgAdmin4
502 947 129 0 8:29AM ?? 0:00.02 postgres: postgres postgres ::1(49607) idle
502 949 129 0 8:29AM ?? 0:00.04 postgres: postgres pega ::1(49623) idle
501 957 826 0 8:30AM ttys000 0:00.00 grep -i postgres