小编425*_*esp的帖子

将 Postgres 超级用户限制为仅限本地连接

我有一个包含多个用户的数据库:foobarsuper。我正在考虑pg_hba.conf锁定访问权限。

我希望允许foobar能够通过密码身份验证从任何 IP 进行连接。或者在本地使用信任身份验证。

我想允许super只能通过信任身份验证在本地登录。切勿来自非本地地址。

我就是从这个开始的。

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# Allow everything if you're on the same machine.
local   all             all                                     trust
host    all             all             127.0.0.1/32            trust
Run Code Online (Sandbox Code Playgroud)

但是,然后我陷入困境,因为我不知道如何说“所有用户,除了超级用户”。我正在寻找这样的东西。

host    all             not_super       all                     md5
Run Code Online (Sandbox Code Playgroud)

我认为我可以采取的一种方法是列出foobar明确。但是,我想知道是否还有其他方法。

host    all             foo             all                     md5
host    all             bar             all                     md5
Run Code Online (Sandbox Code Playgroud)

postgresql authentication

6
推荐指数
1
解决办法
1722
查看次数

标签 统计

authentication ×1

postgresql ×1