现在的位置: 首页 > 综合 > 正文

在Linux上建立ssh隧道

2013年09月29日 ⁄ 综合 ⁄ 共 579字 ⁄ 字号 评论关闭
 

ssh -L 7070:localhost:* remotehost

 

上 面的命令行中,-L指定本地端口与远程主机端口之间的隧道,
7070是本地端口,可以任意设置,只要不和其他已经使用的网络服务冲突就可以。localhost是本地主机,也就是你的电脑,不用更改,*号可以自动
寻找远程主机可用的端口。remotehost就是所要登录的远程SSH主机名称。

 

ssh -qTfnN -D 7070 remoteho
st

All the added options are for a ssh session that’s used for tunneling.

-q :- be very quite, we are acting only as a tunnel.
-T :- Do not allocate a pseudo tty, we are only acting a tunnel.
-f :- move the ssh process to background, as we don’t want to interact with this ssh session directly.
-N :- Do not execute remote command.
-n :- redirect standard input to /dev/null.

In addition on a slow line you can gain performance by enabling compression with the -C option.

抱歉!评论已关闭.