简体   繁体   English

致命:无法访问私钥文件“ /etc/ssl/private/ssl-cert-snakeoil.key”:权限被拒绝

[英]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

courtsey to GabLeRoux 加布勒鲁

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 致命:无法访问私钥文件“/etc/ssl/private/ssl-cert-snakeoil.key”:权限被拒绝 - FATAL: could not access private key file “/etc/ssl/private/ssl-cert-snakeoil.key”: Permission denied 致命:无法创建锁定文件“postmaster.pid”:权限被拒绝 - FATAL: could not create lock file “postmaster.pid”: Permission denied Postgres FATAL:无法打开日志文件权限被拒绝 - Postgres FATAL: could not open log file permission denied 如何使用带有SSL密钥的psql? - How to use psql with SSL key? 安装 Postgres 自定义类型 - 无法访问文件“...”:权限被拒绝 - Installing Postgres custom type - could not access file "...": Permission denied Postgresql 致命:无法创建锁定文件“/var/run/postgresql/.s.PGSQL.5432.lock”:权限被拒绝 - Postgresql FATAL: could not create lock file "/var/run/postgresql/.s.PGSQL.5432.lock": Permission denied postgresql 14 上的 ssl 文件权限不正确 - ssl file permission on postgresql 14 is not right 带有docker的Postgresql:FATAL:无法读取目录的权限:权限被拒绝 - Postgresql with docker: FATAL: could not read permissions of directory: Permission denied 部署 postgresql docker 与 ssl 证书和密钥与卷 - Deploying postgresql docker with ssl certificate and key with volumes Azure 在哪里指定 ssl_cert_file 等? - Where to specify ssl_cert_file and alike at Azure?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM