【发布时间】:2016-01-28 00:50:13
【问题描述】:
我在我的本地计算机上,我只想测试反向 ssh,以便我访问计算机 2 并通过计算机 2 访问计算机 3,并使计算机 3 响应我,假设我想访问计算机 3 上的 postgresql。
如何使用 ssh 和使用端口来做到这一点? 5432是sql的端口
我的做法是这样的:
ssh -L 3000:localhost:5432 <ipaddressof the 2nd computer>
所以我现在在第二台电脑里。
在终端再次输入:
ssh -L 3000:localhost:5432 <ipaddress of the 3rd computer>
我现在在第三台电脑里。而且我不知道该怎么办了,如何访问它的sql?
我尝试了这个不起作用的代码:
psql -U myusername -p 3000
【问题讨论】:
-
这是关于配置和使用现有软件的。 SO 真的是关于如何编写软件的问题。可能在超级用户或 ServerFault 上工作(但我没有使用足够的确定)。
-
这只是在 linux 终端中包含 ssh。
标签: linux networking ssh port tunnel