I've installed PG 9.5 (/usr/pgsql-9.5/) and when I start it manually with postgres -D it has no problems, but if I try to use systemctl I get an error. By looking to journalctl -xen output, I see:

/bin/sh /usr/postgresql-9.5/bin/postgresql95-check-db-dir: permission denied

These are the permissions:

-rwxr-xr-x. root root system_u:object_r:postgresql_exec_t:s0 postgresql95-checkdb_dir

I cannot understand if it's a SELinux problem or something else. Any help?

Putting PostgreSQL in permissive mode (for example semanage permissive -a postgresql_t) solved the problem, but if I can, I want it to stay enforced. Do you know what kind of problem it is?

  • did you run - /usr/pgsql-9.5/bin/postgresql95-setup initdb ?
    – malyy
    Commented Jun 13, 2016 at 11:22
  • 1
    Yes. If I run the check script manually it's all ok
    – Chris
    Commented Jun 13, 2016 at 11:31

1 Answer 1


The problem is the wrong context (postgresql_exec_t). The solution:

semanage fcontext -a -t bin_t "usr/pgsql-9.5/bin(/.*)?"
restorecon -vR /usr/pgsql-9.5/bin

Note the new context bin_t. I thought reading this that `postgresql_exec_t was the correct context.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .