首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在pg_hba.conf 12中读取和更改原始pg_hba.conf

无法在pg_hba.conf 12中读取和更改原始pg_hba.conf
EN

Ask Ubuntu用户
提问于 2020-05-08 10:41:50
回答 1查看 3.9K关注 0票数 0

我无法连接到安装postgresql的aws远程ubuntu服务器。我想从我的电脑连接到ubuntu上的postgres,我不能这样做:

代码语言:javascript
复制
Unable to connect to server:
FATAL: no pg_hba.conf entry for host "xxx.xxx.xxx.xxx", user "postgres", database "postgres", SSL on
FATAL: no pg_hba.conf entry for host "xxx.xxx.xxx.xxx", user "postgres", database "postgres", SSL off

我知道我应该加上

代码语言:javascript
复制
host all all all md5
or
host all all 0.0.0.0/0 trust
or
host all all 0.0.0.0/0 md5

但是,当我想从Putty打开pg_hba.conf时,我做了sudo nano /etc/postgresql/12/main/bg_hba.conf,我看到空列表,下面写着“但是在/etc/postgresql/12/main/中,我看到了这个文件/etc/postgresql/12/main/bg_hba.conf

如果我使用sudo sh -c 'echo "host all all 0.0.0.0/0 trust" >> /etc/postgresql/12/main/bg_hba.conf',我将创建新的文件bg_hba.conf,但所有者将是root用户。以下是一些细节:

代码语言:javascript
复制
$ psql -V
psql (PostgreSQL) 12.2 (Ubuntu 12.2-2.pgdg18.04+1)
$ pg_config --version
PostgreSQL 12.2 (Ubuntu 12.2-2.pgdg18.04+1)
$ postgres -V
$ locate bin/postgres
/usr/lib/postgresql/12/bin/postgres
$ /usr/lib/postgresql/12/bin/postgres -V
postgres (PostgreSQL) 12.2 (Ubuntu 12.2-2.pgdg18.04+1)
$ pg_lsclusters
Ver Cluster Port Status Owner    Data directory              Log file
12  main    5432 online postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
$ /etc/postgresql/12/main/pg_hba.conf
-bash: /etc/postgresql/12/main/pg_hba.conf: Permission denied

请帮帮我!在/etc/postgresql/12/main/postgresql.conf中,我有listen_addresses = '*',我看到postgresql.conf有rw-r--r--,bg_hba.conf是rw-r-----,我看不懂为什么和如何更改thad)

EN

回答 1

Ask Ubuntu用户

发布于 2020-05-08 13:33:06

好吧!我遇到了问题,在'bg_hba.conf' -> 'pg_hba.conf' /etc/postgresql/12/main/bg_hba.conf'的文本路径上出现了一个小错误-> /etc/postgresql/12/main/pg_hba.conf'

票数 0
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1236986

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档