Home > Database > Mysql Tutorial > PostgreSQL数据文件权限不对导致开机启动失败的问题

PostgreSQL数据文件权限不对导致开机启动失败的问题

WBOY
Release: 2016-06-07 14:53:35
Original
2933 people have browsed it

PostgreSQL数据文件权限不对导致开机启动失败的问题 上午开发告知机子重启后DB连接不了了,登进去一开,确实,进程啥的都没有起来。 手工启动: [postgres@develop ~]$ pg_start server starting [postgres@develop ~]$ps -ef|grep postgres www.2cto.com 发


PostgreSQL数据文件权限不对导致开机启动失败的问题

 

上午开发告知机子重启后DB连接不了了,登进去一开,确实,进程啥的都没有起来。 

 

手工启动:

[postgres@develop ~]$ pg_start

server starting

[postgres@develop ~]$ps -ef|grep postgres

  www.2cto.com  

发现还是没起来,查看日志,里面有如此报错信息:

 

[postgres@develop ~]$ tail -f pg_log

FATAL:  data directory "/home/postgres/data" has wrong ownership

HINT:  The server must be started by the user that owns the data directory.

FATAL:  data directory "/home/postgres/data" has wrong ownership

HINT:  The server must be started by the user that owns the data directory.

FATAL:  data directory "/home/postgres/data" has wrong ownership

HINT:  The server must be started by the user that owns the data directory.

FATAL:  data directory "/home/postgres/data" has group or world access

DETAIL:  Permissions should be u=rwx (0700).

 

信息给得很详细,postgresql的数据文件权限被改了,起码现在不是0700(只有用户权限)。
返回去一看, 现在果然是777权限了。而且用户的所属也被改了,改成其他用户了。 

[postgres@develop ~]$ ll /home/postgres

drwxrwxrwx 14 tomcat ddd     4096 10-29 09:41 data

 

改回去:

[postgres@develop ~]$chown -R postgres:postgres  /home/postgres/data

[postgres@develop ~]$chmod 0700 /home/postgres/data

 

查看:  www.2cto.com  

drwx------ 14 postgres postgres     4096 10-29 09:41 data

 

再启动

[postgres@develop ~]$ pg_start

server starting

 

正常了。后来了解到是开发的一个误操作,改其他文件的权限的时候把DB文件的用户组权限也改了  。

 

总结:

默认情况下,PostgreSQL启动时,启动DB用户必须拥有数据文件的所属权限(user权限),且权限不能过大,否则就会报上述错误。其实这是一个安全的保护措施,防止DB文件因为权限开设太大而被其他非允许的用户访问。

 

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template