大网数据广告活动
服务器运维问答

What should the permissions be on for PostgreSQL /data files?

· 52CE 我爱测

I installed Postgres 9.3 from the osX binary. When I attempted to restart using pg_ctl restart, I received the following error: $ pg_ctl restart pg_ctl: could not open PID file "/Library/PostgreSQL/9.3/data/postmaster.pid": Permi…

问题原文

原帖链接 · BryanWheelock · CC BY-SA 3.0

I installed Postgres 9.3 from the osX binary.
When I attempted to restart using pg_ctl restart, I received the following error:

$ pg_ctl restart
pg_ctl: could not open PID file "/Library/PostgreSQL/9.3/data/postmaster.pid": Permission denied

Bryan@bryans-mbp Fri Jun 13 13:41:24 ~   
$ sudo ls -la /Library/PostgreSQL/9.3/data/postmaster.pid  
Password:  
-rw-------  1 postgres  daemon  75 Jun 11 10:36 /Library/PostgreSQL/9.3/data/postmaster.pid  

Who should own this file and what should the permissions be?

社区高分解答

原帖链接 · Eirik Toft · CC BY-SA 3.0

The permissions are correct as you want all of the data files and other associated stuff to be owned by the postgres user. I think the issue here is that the postgres daemon is not running as the postgres user.

To check which user the postgres daemon (postmaster) is running as, run:

Most *NIX (Like Solaris):

ps -ef | grep postgres

Linux

ps aux | grep postgres

Make sure that as root, you are running:

sudo -u postgres pg_ctl -D /Library/PostgreSQL/9.3/data start

Adjust the necessary paths for pg_ctl and sudo.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2014-06-16)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。