uuair
V2EX  ›  问与答

ssh 隧道多端口转发问题

  •  
  •   uuair · May 17, 2015 · 1724 views
    This topic created in 4041 days ago, the information mentioned may be changed or developed.

    我搜了网络好久好久,终于建立了ssh隧道,但是还有两个问题没法解决。

    1. 我需要转发22端口以及80端口给外网,使用了autossh道具,哪怕是ssh道具,也是不知道该如何转发两个,莫非要运行两次autossh么?
    2.如果想实现centos的开机启动autossh,我不清楚如何操作。有一个网站是这么写的:
    /bin/su -c '/usr/bin/autossh -M 5678 -NR 1234:localhost:2223 [email protected] -p2221' - user1
    对于上面的写法,我看不懂,尤其是最后的user1,是写我的用户名么?另外,上面的代码是用在非root用户上的,在centos中,这个命令应该放到哪里才可以运行?

    1 replies    2015-05-19 22:25:04 +08:00
    uuair
        1
    uuair  
    OP
       May 19, 2015
    第一个问题我自己解决了
    使用两次-NR 1234:*:1234这样的方式就可以,后面还可以无限接。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3305 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 13:08 · PVG 21:08 · LAX 06:08 · JFK 09:08
    ♥ Do have faith in what you're doing.