【发布时间】:2020-01-24 18:45:07
【问题描述】:
基本上我想在启动时编写 .bat 文件,在后台执行反向隧道
所以这些是我在批处理文件中尝试过但没有工作的东西
ssh -fN -o StrictHostKeyChecking=no -R port1:localhost:port2 user@ip
ssh -f -o StrictHostKeyChecking=no -R port1:localhost:port2 user@ip
start /min cmd.exe /C "ssh -fN -o StrictHostKeyChecking=no -R port1:localhost:port2 user@ip"
start /min cmd.exe /C "ssh -f -o StrictHostKeyChecking=no -R port1:localhost:port2 user@ip"
start /min cmd.exe /C "ssh -o StrictHostKeyChecking=no -R port1:localhost:port2 user@ip"
当我不包含选项 N 并说 -f 时,它不起作用并且我无法从另一端连接
当我说 -fN 时,奇怪的是(有或没有 /min)会生成一个新的空 cmd shell,即使我手动关闭它,我仍然可以连接!尝试在超时后杀死 cmd.exe 以自动关闭它,但没有奏效
但必须有办法,我如何在批处理文件中发送反向 ssh 隧道而不让用户注意到它?
【问题讨论】:
标签: windows batch-file ssh ssh-tunnel tunnel