Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Postgresql 致命:无法访问私钥文件/etc/ssl/private/ssl证书snakeoil.key“拒绝许可_Postgresql_Ubuntu_Ssl - Fatal编程技术网

Postgresql 致命:无法访问私钥文件/etc/ssl/private/ssl证书snakeoil.key“拒绝许可

Postgresql 致命:无法访问私钥文件/etc/ssl/private/ssl证书snakeoil.key“拒绝许可,postgresql,ubuntu,ssl,Postgresql,Ubuntu,Ssl,这是我输入的内容: user@user-computer:/usr/lib/postgresql/9.4/bin$ ./postgres -D /etc/postgresql/9.4/main/ 这就是我得到的: [4173-1] FATAL: could not access private key file "/etc/ssl/private/ssl-cert-snakeoil.key": Permission denied 有人能帮我吗?我应该更改ss-cert…密钥文件的权限吗 发

这是我输入的内容:

user@user-computer:/usr/lib/postgresql/9.4/bin$ ./postgres -D /etc/postgresql/9.4/main/
这就是我得到的:

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

有人能帮我吗?我应该更改ss-cert…密钥文件的权限吗

发生此错误的原因是您试图以自己的非特权用户身份启动PostgreSQL,而它并不打算这样运行

Ubuntu提供的PostgreSQL打包方式应该是:

 $ sudo /etc/init.d/postgresql start
 #   or
 $ sudo service postgresql start
或使用
pg_ctlcluster
进行更细粒度的控制,请参阅
postgres
用户不属于
ssl证书
用户组时,可能会发生这种情况 尝试将
postgres
用户添加到组
ssl证书

确保
postgres
/var/lib/postgresql/version\u no/main
例如:
sudo chown postgres-R/var/lib/postgresql/9.6/main/

运行以下代码修复用户组问题并修复权限

# > 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
#>这件事发生在我身上,结果我错误地将postgres用户从“ssl证书”组中删除,并用
sudo gpasswd-postgres ssl证书
#固定所有权和模式
sudo chown root:ssl-cert/etc/ssl/private/ssl-cert-snakeoil.key
sudo chmod 740/etc/ssl/private/ssl-cert-snakeoil.key
#现在postgresql启动了!(并且安装命令不再失败)
sudo服务postgrestart

#也可以尝试运行pg_ctlcluster to GabLeRoux

如果您不喜欢我问问题的方式,请告诉我如何更改它或它有什么问题,以便我可以改进问题;而不是给我一个-1。。。这没有帮助。谢谢,这正是问题所在,但不幸的是,这不是唯一的问题,在我尝试了您的解决方案后,我遇到了另一个错误:“chmod:更改“/var/run/postgresql”的权限:不允许操作”。因此,我决定完全重新安装我的postgresql实例,并按照本文中的说明进行操作:在这之后,您的解决方案开始工作:)thnx。