jim*_*iat 3 linux ssh-tunneling
我有一个运行 linux 的 AWS 云服务器,我从家里的电脑连接到它。到目前为止,我曾经使用 Putty 连接到它(Windows),但我刚刚为我的家用计算机切换到 Linux。
我试图弄清楚如何在使用私钥通过 ssh 连接时创建隧道。
不同文档网站上的示例非常简单:
要连接到远程服务器:
ssh -i <key_file> user@xx.xx.xxx.xxx
这确实有效。
但是要创建一个隧道,文档提到
ssh -L8080(portnumber):user@xx.xx.xxx.xxx:8080(remoteport)
但是没有提到如何像第一个示例中那样使用私钥创建隧道。
我试过 ssh -i <key_file> -L8080(portnumber):user@xx.xx.xxx.xxx:8080(remoteport)
但它没有用。
任何人都可以在使用私钥时提供正确的命令来创建隧道吗?谢谢!
小智 14
您将端口转发与主机(要连接到)混为一谈。
公式很简单:
ssh user@host -i keyfile.pem -L 1234:127.0.0.1:2345
Run Code Online (Sandbox Code Playgroud)