在Linux上建立ssh隧道(转)

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

来自于:http://www.ej38.com/showinfo/linux-135697.html

posted on 2012-06-27 15:50  云中道长  阅读(267)  评论(0编辑  收藏  举报

导航