Win上有好用的Xshell,可以做SSH隧道,但是Linux没有很好用的工具,本来gSTM还可以,但是死活装不上,也很久没更新了。

但其实,Linux上直接使用ssh命令就可以创建SSH隧道,非常方便。

ssh -L 9000:localhost:5432 user@example.com

-L 后的含义是: -L local-port:host:remote-port,最后面是远程服务器的登录用户名和IP地址。

敲入命令后,提示输入密码,即可创建隧道:通过本机的localhost:9000可以访问远程服务器上的localhost:5432。

此外,还有一些类似的命令:

ssh -f user@example.com -L 9000:localhost:5432 -N

这里的-f可以强制使ssh连接在后台保持运行,-N则告诉openSSH不需要在远程服务器上执行任何命令。

 

参考:

1. Quick-Tip: SSH Tunneling Made Easy,http://www.revsys.com/writings/quicktips/ssh-tunnel.html

 

相关文章:

  • 2021-09-15
  • 2022-01-08
  • 2021-06-20
  • 2021-06-21
猜你喜欢
  • 2021-08-14
  • 2021-05-04
  • 2021-06-18
  • 2021-06-30
  • 2021-12-05
  • 2021-05-19
相关资源
相似解决方案