通过 SSH 隧道连接到 Postgres 服务器 - 权限被拒绝

问题描述 投票:0回答:0

我正在尝试通过 SSH 隧道连接到我的 Postgres 服务器,

我将这一行添加到 postgres.conf

listen_addresses='*'

和这些行到 pg_hba.conf

host all all 0.0.0.0/0 md5

host all all ::0/0 md5

我还向防火墙添加了一条新规则以接受对 postgresql 端口 5432 的请求:

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW       Anywhere
Nginx HTTP                 ALLOW       Anywhere
Nginx Full                 ALLOW       Anywhere
OpenSSH                    ALLOW       Anywhere
5432/tcp                   ALLOW       Anywhere
22/tcp (v6)                ALLOW       Anywhere (v6)
Nginx HTTP (v6)            ALLOW       Anywhere (v6)
Nginx Full (v6)            ALLOW       Anywhere (v6)
OpenSSH (v6)               ALLOW       Anywhere (v6)
5432/tcp (v6)              ALLOW       Anywhere (v6)

现在,当我尝试使用 pgAdmin 连接到我的 postgres 服务器时,出现了这个错误: (https://i.stack.imgur.com/tv2J6.png) (https://i.stack.imgur.com/drwHQ.png)

当我尝试使用此命令通过控制台连接时:

ssh -L 5432:localhost:5432 -Y user@remoteip 
我得到这个错误:

bind [127.0.0.1]:5432: Permission denied
channel_setup_fwd_listener_tcpip: cannot listen to port: 5432
Could not request local forwarding.

所以有人可以帮助我吗?

postgresql ubuntu remote-access
© www.soinside.com 2019 - 2024. All rights reserved.