Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bash 如何以编程方式编辑pg_hba.conf?_Bash_Postgresql_Ubuntu_Pg Hba.conf - Fatal编程技术网

Bash 如何以编程方式编辑pg_hba.conf?

Bash 如何以编程方式编辑pg_hba.conf?,bash,postgresql,ubuntu,pg-hba.conf,Bash,Postgresql,Ubuntu,Pg Hba.conf,我正在寻找一种以编程方式编辑pg_hba.conf的方法,类似于pg_conftool允许您编辑postgresql.conf: ~$ pg_conftool 11 main set timezone 'UTC' 我尝试使用pg\u conftool编辑pg\u hba.conf。不幸的是,它只允许添加/删除key=value条目,这不是pg_hba.conf所期望的格式 我可以使用echo和sed来实现我想要的,但是我想知道是否有更好的方法。我在postgresql common中找到了一个

我正在寻找一种以编程方式编辑
pg_hba.conf
的方法,类似于
pg_conftool
允许您编辑
postgresql.conf

~$ pg_conftool 11 main set timezone 'UTC'
我尝试使用
pg\u conftool
编辑
pg\u hba.conf
。不幸的是,它只允许添加/删除
key=value
条目,这不是
pg_hba.conf
所期望的格式

我可以使用
echo
sed
来实现我想要的,但是我想知道是否有更好的方法。我在
postgresql common
中找到了一个工具
pg_hba
,这似乎就是我要找的:

我已经安装了
postgresql common
version
201.pgdg18.04+1
,但是,我不知道如何访问/安装/调用
pg_hba


pg_hba
工具是否适合该作业?如果是,如何为Ubuntu“安装”二进制文件?如果没有,是否有其他推荐的编程编辑方法?

我们还没有一种编辑pg_hba.conf的好方法。找到的pg_hba二进制文件仍然是WIP。如果它对您有效,请告诉我们,我们可以确定将其安装到/usr/bin是否有意义

现在起作用的是“pg_conftool 11 main pg_hba.conf edit”,但这只会为您提供一个编辑器


另一个选择可能是,它有一个Pg_Hba“镜头”。(Puppet在本地支持这一点。)

碰巧有人在博客上提到了这一点: