linux ssh反向代理

时间:2023-03-09 06:01:51
linux ssh反向代理

参考:https://segmentfault.com/a/1190000002718360

内外运行:
sshpass -p 123456 ssh -fNR 5000:localhost:22 serveruser@101.200.50.71

外网运行:
ssh -fCNL "*:5005:localhost:5000" serveruser@localhost

注意:
(1)serveruser是外网linux的账号
(2)后面一条不能sshpass,必须手动输入密码不知道为什么
(3)客户端连接:ssh -p 5005 wyt@101.200.50.71,这个账号是内网linux账号