在 postgresql 14 上啟用 ssl 后,啟動 Postgres 服務器時出現錯誤:
2022-05-13 00:09:39.791 CST [938050] FATAL: private key file "/etc/postgresql/14/main/server.key" has group or world access
2022-05-13 00:23:09.163 CST [938097] DETAIL: File must have permissions u=rw (0600) or less if owned by the database user, or permissions u=rw,g=r (0640) or less if owned by root.
我所做的是按照上面的提示和chmod 640 server.key. 這是之后的當前權限輸出chmod(似乎只洗掉了組的 r)
-rw-r--r-- 1 root root 2727 May 13 00:08 server.crt
-rw-r----- 1 root root 3323 May 13 00:08 server.csr
-rw-r----- 1 root root 1704 May 13 00:08 server.key
但是重啟 Postgres 服務器還是有錯誤:
2022-05-13 00:38:09.331 CST [938235] FATAL: could not load private key file "/etc/postgresql/14/main/server.key": Permission denied
2022-05-13 00:38:09.331 CST [938235] LOG: database system is shut down
pg_ctl: could not start server
ssl 檔案權限在這里缺少什么?
uj5u.com熱心網友回復:
首先,將所有檔案的所有權更改為 PostgreSQL 用戶:
chown postgres server.crt server.key server.csr
然后從私鑰檔案中洗掉組的讀取權限:
chmod g-r server.key
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/475915.html
標籤:PostgreSQL ssl
