使用yum安装完postgresql,没有使用默认的DATA地址,自己配置了DATA地址以后,使用root权限启动service

service postgresql start

,报出了"FAILED"

不解,检查Log文件 /var/lib/pgsql/pgstartup.log. 发现如下记录

postmaster cannot access the server configuration file
"/var/lib/pgsql/data/postgresql.conf": Permission denied

于是检查postgres用户的文件权限,没有明显的问题,可读可写(忘了好像是700),于是上网一查,基本怀疑问题在SELinux上

先检查SELinux状态

# sestatus
SELinux status:                 enabled
SELinuxfs mount:                /selinux
Current mode:                   enforcing
Mode from config file:          enforcing
Policy version:                 21
Policy from config file:        targeted
 

果然是运行状态,并且还是在"enforcing"模式,检查SELinux的Log(大部分情况在/var/log/audit/,有时也会被配置到/var/log/messages)

# grep postgres /var/log/audit/audit.log | grep denied | tail -1
 
type=AVC msg=audit(1234567890.334:432): avc:  denied  { read } for
pid=1234 comm="postmaster" name="pgsql" dev=newpgdisk ino=403123 
scontext=user_u:system_r:postgresql_t:s0
tcontext=system_u:object_r:var_lib_t:s0 tclass=lnk_file

有一条拒绝记录!就这玩意干的。

这里说个最简单干脆的方法,停用SELinux.

编辑/etc/selinux/config:

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of these two values:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted

将SELINUX=enforcing 改成 SELINUX=permissive或者SELINUX=disabled,重启系统

再次启动postgresql,问题解决

可参考:http://blog.endpoint.com/2009/09/permission-denied-for-postgresqlconf.html

http://www.crypt.gen.nz/selinux/disable_selinux.html

http://www.centos.org/docs/5/html/5.2/Deployment_Guide/sec-sel-enable-disable.html

[Postgres]postgresql.conf : Permission denied处理一法的更多相关文章

  1. Postgresql ERROR: permission denied for relation app_info

    启用终端,: 进入mydb数据库:\c mydb 然后给当前数据库的角色赋予权限:GRANT ALL PRIVILEGES ON TABLE 表名  TO 角色名;

  2. docker postgresql FATAL: could not access private key file "/etc/ssl/private/ssl-cert-snakeoil.key": Permission denied

    在docker中启动postgresql时出现错误 FATAL:  could not access private key file "/etc/ssl/private/ssl-cert- ...

  3. Apache Permission denied (httpd.conf配置和目录权限无问题)解决办法

    今天在CentOS5.9中配置zabbix时出现错误:Apache 403 error, (13)Permission denied: access to / denied 检查了一圈httpd.co ...

  4. postgresql connection failure:SQLSTATE[08006] [7] could not connect to server: Permission denied Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432?

    PHP 程序无法连接到 CentOS 上的PostgreSQL,但是在 CentOS 服务器上却能正常运行 psql, 操作如下:多次重启 PG 数据库后发现 CGI 脚本无法连接数据库,但是可以使用 ...

  5. Understanding postgresql.conf : log*

    After loooong pause, adding next (well, second) post to the “series“. This time, I'd like to describ ...

  6. vsftpd安装配置 530 Permission denied.错误

    yum install vsftpd service vsftpd start 530 Permission denied.错误 /etc/vsftpd/user_list    该文件里的用户账户在 ...

  7. [转]HDFS客户端的权限错误:Permission denied

    搭建了一个Hadoop的环境,Hadoop集群环境部署在几个Linux服务器上,现在想使用windows上的Java客户端来操作集群中的HDFS文件,但是在客户端运行时出现了如下的认证错误. 错误的详 ...

  8. org.apache.hadoop.security.AccessControlException: Permission denied:

    org.apache.hadoop.security.AccessControlException: Permission denied: user=xxj, access=WRITE, inode= ...

  9. 解决mac os x下 tomcat启动报 java.net.BindException: Permission denied <null>:80 错误

    我在mac os x上启动tomcat的时候,报 java.net.BindException: Permission denied <null>:80,java.net.BindExce ...

随机推荐

  1. Android BroadcastReceiver 的简单实现

    参考:http://yangguangfu.iteye.com/blog/1063732 BroadcastReceiver的实现不难,其实就是三部曲:注册,接收,发送. 但有一点较疑惑的是:当我启动 ...

  2. Selenium Webdriver——Xpath轴定位(preceding)

     1.preceding-sibling 选取当前节点之前的所有同级节点 text=出发之前的同级节点: 2.preceding 选取当前节点开始标签之前的所有节点 text=出发节点标签之前的所有i ...

  3. 实战zabbix3.0.2 使用percona mysql插件监控mysql5.7

    1.系统环境 [root@shard0 templates]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.2 ...

  4. [ShaderStaff] 圆角矩形效果实现

    操作系统:Windows8.1 显卡:Nivida GTX965M 开发工具:Unity2017.3 | Shader 最近在制作一款APP,其中需要对矩形图片资源的展现进行圆角化,看了一下网上的方案 ...

  5. ansible debug

    <demoredis_redis_1> ESTABLISH DOCKER CONNECTION FOR USER: ?<demoredis_redis_1> EXEC ['/u ...

  6. 有道笔记链接地址 -----关于python

    一.python相关 python列表的操作[list[]]:     http://note.youdao.com/noteshare?id=93922f3174b1d8fac04514064656 ...

  7. Ubuntu使用ttyS*(如mincom)时不需root权限的方法

    很久很久以前,我们在Ubuntu下使用软件(如minicom.screen等)访问串口时,是不需要任何超级权限的(使用minicom时,只有使用-s选项时需要root权限):不知道从哪个版本(12.0 ...

  8. 滑动窗口的最大值 · sliding-window-maximum

    [抄题]: Given an array nums, there is a sliding window of size k which is moving from the very left of ...

  9. 解题报告-908. Smallest Range I

    题目 : Given an array A of integers, for each integer A[i] we may choose any x with -K <= x <= K ...

  10. 关于eclipse创建java项目时产生的.settings文件:

    在用eclipse创建一个java项目,在项目目录下面往往会发现.settings文件夹并包含一个org.eclipse.core.resources.prefs文件条目. 这个条目是配置项目的编码方 ...