PostgreSQL 10.6 and CentOS 7
pg_ctl status
pg_ctl: could not access directory "/var/lib/pgsql/data": Permission denied`
Wouldn't pg_ctl have access to this, given /var/lib/pgsql/data has ownership postgres:postgres?
drwx------ 3 postgres postgres 94 Nov 14 06:43 pgsql
How can I fix this without creating a vulnerability? Why is this throwing an error?
Additional info (edit):
su - postgres
cd /var/lib
/var/lib/pgsql: drwx------ 3 postgres postgres 94 Nov 14 06:43 pgsql
/var/lib/pgsql/10: drwx------ 4 postgres postgres 33 Nov 14 06:38 10
/var/lib/pgsql/10/data: drwx------ 20 postgres postgres 4096 Nov 15 03:47 data
In UNIX, each process runs with the permissions of the user that starts the executable, not the owner of the executable (unless the SETUID flag is set).
So it doesn't matter who owns
pg_ctl, but you have to be userpostgreswhen you run it.