新浪博客

SecureCRT remote port forwarding/X11 配置方法

2013-08-28 15:52阅读:
缺省情况下,remote-port-forwarding只能将本地(ssh client端)端口映射到远端(sshd端)的127.0.0.1上,这里介绍允许公网访问的方法。
1,sshd server配置
修改/etc/ssh/sshd_config如下:
AllowTcpForwarding yes
GatewayPorts yes
其他有关的参数使用缺省即可:X11Forwarding,X11DisplayOffset,X11UseLocalhost等
重启sshd:/etc/init.d/sshd restart

2,X server
在管理员机上安装xming或cygwin等Xserver软件,并启动,检查6000端口

3,secureCRT的session配置
设置Port forwarding -> Remote/X11, remote和local都是用6000端口即可,勾选'Forward X11 packets'。
此时以为已完成了,但事实上仍然只能从远端的127.0.0.1访问。从远端(sshd)的 /var/log/secure日志中可以看到类似下面的信息:
sshd[9162]: channel 2: open failed: administratively prohibited: Rejecting remote forward request from a.b.c.d:18826 to 127.0.0.1:6000 because the current filters do not allow a.b.c.d:18826 to use the remote forward.
如果secureCRT开启'Trace Options'开关,能在本地看到类似信息。
下面的步骤非常关键:
使用notepad等工具打开编辑session的ini配置文件。找到 S:'Reverse Forward Filter',该项目缺省仅allow,127.0.0.1,0 deny,0.0.0.0/0.0.0.0,0 。这是被filter的关键原因。
修改该配置项目,重启seureC
RT再连接,即可。 相关对应Local port forwarding的参数是:S:'Port Forward Filter'。 注意如果该配置项目格式不正确,会被secureCRT恢复缺省配置, 开放某一ip而非网段时,不要写成 allow,1.2.3.4/255.255.255.255,0 secureCRT6.5会认为是错误的写法,应写成 allow,1.2.3.4,0

参考:
http://forums.vandyke.com/showthread.php?t=1839
http://en.helpdoc-online.com/securecrt_6/source/configuring_port-forwarding_filters.htm
http://jerrywens.blog.com/2011/08/18/configure-ssh-support-port-forwarding/

我的更多文章

下载客户端阅读体验更佳

APP专享