小编Jos*_*ton的帖子

无法通过 ssh 连接到转发端口

我有两台服务器。服务器 1 可以访问我有权访问但不能通过 SSH 登录的服务器上的 Oracle 实例。我想使用 SSH 端口转发从服务器 2 连接到服务器 1,再从那里连接到 Oracle 实例。我已经设置了GatewayPorts=yesAllowTcpForwarding=yes但我仍然觉得有些不对劲。

出于这个问题的目的,我只想专注于从服务器 2 端口从 16951 向前连接到服务器 1(端口 5432)上的 postgres 实例。

运行后:

ssh -L 16951:localhost:5432 server1 -nNT -f -g
Run Code Online (Sandbox Code Playgroud)

从服务器 2,我可以"localhost.16951"在运行netstat检查打开的端口后看到,这使我相信该端口正在成功侦听。

当我运行时:

psql -U jbarton -p 16951
Run Code Online (Sandbox Code Playgroud)

我收到一条消息说没有监听端口 localhost:16951

    psql: could not connect to server: No such file or directory
     Is the server running locally and accepting
     connections on Unix domain socket "/tmp/.s.PGSQL.16951"?
Run Code Online (Sandbox Code Playgroud)

非常感谢任何意见、答案或建议。

更新

当我现在使用 oracle 尝试此操作时,使用连接:./sqlplus W_USER/password@//localhost:16951/dbname …

ssh postgresql forwarding

5
推荐指数
1
解决办法
1201
查看次数

标签 统计

forwarding ×1

postgresql ×1

ssh ×1