Search code examples
postgresqlubuntussl

FATAL: could not access private key file "/etc/ssl/private/ssl-cert-snakeoil.key": Permission denied


This is what I enter:

user@user-computer:/usr/lib/postgresql/9.4/bin$ ./postgres -D /etc/postgresql/9.4/main/

This is what I get:

[4173-1] FATAL:  could not access private key file "/etc/ssl/private/ssl-cert-snakeoil.key": Permission denied

Can anyone help me? should I change permissions on ss-cert...key file?


Solution

  • The error happens because you're trying to launch PostgreSQL as your own unpriviledged user, and it's not meant to run like that.

    Ubuntu provides PostgreSQL packaged in a way that it should be launched with:

     $ sudo /etc/init.d/postgresql start
     #   or
     $ sudo service postgresql start
    

    or for finer-grained control with pg_ctlcluster, see http://manpages.ubuntu.com/manpages/trusty/man8/pg_ctlcluster.8.html