[英]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?
我应该更改ss-cert ... key文件的权限吗?
The error happens because you're trying to launch PostgreSQL as your own unpriviledged user, and it's not meant to run like that. 发生错误是因为您试图以自己的非特权用户身份启动PostgreSQL,但它并不意味着那样运行。
Ubuntu provides PostgreSQL packaged in a way that it should be launched with: Ubuntu提供的PostgreSQL打包方式应通过以下方式启动:
$ 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 或使用
pg_ctlcluster
进行更细粒度的控制,请参阅http://manpages.ubuntu.com/manpages/trusty/man8/pg_ctlcluster.8.html
This can happen when the postgres
user doesnt belong to ssl-cert
usergroup Try adding postgres
user to the group ssl-cert
当发生这种情况
postgres
用户犯规属于ssl-cert
所在的用户组尝试添加postgres
用户组ssl-cert
make sure that postgres
is the owner of /var/lib/postgresql/version_no/main
eg: sudo chown postgres -R /var/lib/postgresql/9.6/main/
确保
postgres
是/var/lib/postgresql/version_no/main
的所有者,例如: sudo chown postgres -R /var/lib/postgresql/9.6/main/
Run the below code to fix the usergroup issue and fixing the permissions 运行以下代码来修复用户组问题并修复权限
# > It happened to me and it turned out that I removed erroneously the postgres user from "ssl-cert" group, set it back with
sudo gpasswd -a postgres ssl-cert
# Fixed ownership and mode
sudo chown root:ssl-cert /etc/ssl/private/ssl-cert-snakeoil.key
sudo chmod 740 /etc/ssl/private/ssl-cert-snakeoil.key
# now postgresql starts! (and install command doesn't fail anymore)
sudo service postgres restart
#also try running pg_ctlcluster <version> <cluster> <action>
sudo pg_ctlcluster 9.6 main start
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.