flossfan
flossfan

Reputation: 10854

postgres cannot access the server configuration file: Permission denied

This is baffling me (trying to set up postgres on MacOS Lion):

delirium:$ sudo ls -al /usr/local/pgsql/data/
total 64
drwx------  15 postgres  postgres    510 25 May 10:36 .
drwxr-xr-x@ 13 103       103         442 25 May 10:35 ..
-rw-------   1 postgres  postgres      4 25 May 10:36 PG_VERSION
drwx------   5 postgres  postgres    170 25 May 10:36 base
drwx------  41 postgres  postgres   1394 25 May 10:36 global
drwx------   3 postgres  postgres    102 25 May 10:36 pg_clog
-rw-------   1 postgres  postgres   3652 25 May 10:36 pg_hba.conf
-rw-------   1 postgres  postgres   1631 25 May 10:36 pg_ident.conf
drwx------   4 postgres  postgres    136 25 May 10:36 pg_multixact
drwx------   2 postgres  postgres     68 25 May 10:36 pg_stat_tmp
drwx------   3 postgres  postgres    102 25 May 10:36 pg_subtrans
drwx------   2 postgres  postgres     68 25 May 10:36 pg_tblspc
drwx------   2 postgres  postgres     68 25 May 10:36 pg_twophase
drwx------   4 postgres  postgres    136 25 May 10:36 pg_xlog
-rwxr-xr-x   1 postgres  postgres  16879 25 May 10:36 postgresql.conf
delirium:$ /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data
postgres cannot access the server configuration file "/usr/local/pgsql/data/postgresql.conf": Permission denied

Doesn't the output show that postgres is the owner of postgresql.conf? So why can't it access the file?

What can I do?

Upvotes: 5

Views: 23993

Answers (2)

PartialOrder
PartialOrder

Reputation: 2960

sudo -u postgres /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data

...assuming postgres was set up with default user postgres

Upvotes: 1

Philip Couling
Philip Couling

Reputation: 14883

The quickest way to diagnose a permission denied error is to login (su or sudo) as that user and try to cat the file.

If this is permission denied and not file not found, I'm guessing the postgres user has not got execute permissions on one of the parent directories, it could be any of the 3: /usr/local/pgsql/

Upvotes: 3

Related Questions