0
votes

I am trying the following command load schema and data from .dump file :

psql proj1 -f /Users/utkarshatri/Desktop/proj1/mymyunsw.dump

but it says permission denied.

enter image description here

the folder containing the .dump file has read write permissions for postgres

total 101728
drwxr-xr-x@ 4  utkarshatri staff 136      24 Mar 05:41 ./
drwx------@ 23 utkarshatri staff 782      24 Mar 06:18 ../
-rwxrw-rw-@ 1  utkarshatri staff 52080321  8 Mar 00:30 mymyunsw.dump*
-rwxr--r--@ 1  utkarshatri staff 2130      8 Mar 00:30 proj1.sql*

simple cat on terminal works but returns permission denied on postgres commandline enter image description here

How do I fix this?

Any help would be appreciated.

1
Can you just try a simple cat on that file and see if you still get the same error? - Matt Clark
@MattClark simple cat on terminal works but returns permission denied when using postgres commandline - Utkarsh Atri
Can you provide the relevant output of ls -alF proj1, please include the entries for ., .., and the .dump file. - Matt Clark
@MattClark total 101728 drwxr-xr-x@ 4 utkarshatri staff 136 24 Mar 05:41 ./ drwx------@ 23 utkarshatri staff 782 24 Mar 06:18 ../ -rwxrw-rw-@ 1 utkarshatri staff 52080321 8 Mar 00:30 mymyunsw.dump* -rwxr--r--@ 1 utkarshatri staff 2130 8 Mar 00:30 proj1.sql* - Utkarsh Atri

1 Answers

1
votes

The issue seems to be not with the current directory, but the directory, one level above:

drwx------@ 23 utkarshatri staff 782      24 Mar 06:18 ../

This is showing that only your user has the permissions required to enter the project directory. Try running this

chmod a+rx ../

This will change the permissions such that anyone on the system can open and look inside the directory, but still, only you will be able to write.