如何配置PostgreSQL以接受除postgres/admin之外的所有传入连接



我的问题是如何配置它,以便非管理员(非postgres(帐户可以从互联网登录,但管理员(postgres"用户只能从本地主机或有限的IP范围登录。pg_hba.conf中的哪些条目允许我进行设置?我已经在postgresql.conf:中设置了这个

listen_addresses = '*'

我还在我的pg_hba.conf中添加了一行,以允许从广阔的开放世界登录:

host all all 0.0.0.0/0 md5

但现在postgres使用可以从任何地址登录,这不是我想要的:(

我看到很多地方都在谈论如何打开PostgreSQL以连接任何地址,比如:https://dba.stackexchange.com/questions/83984/connect-to-postgresql-server-fatal-no-pg-hba-conf-entry-for-host但没有打开它并锁定CCD_ 5用户的问题。

尝试:

# "local" is for Unix domain socket connections only
local   all             postgres                                trust
# IPv4 local connections:
host    all             postgres        0.0.0.0/0               reject 
host    all             all             0.0.0.0/0               md5 

最新更新