如何以编程方式禁用远程服务器上的防火墙

时间:2016-05-25 13:49:33

标签: java expectj

到目前为止,我试过这个:

ExpectJ expectinator = new ExpectJ(20);

try {
       Spawn shell = expectinator.spawn(ip, 22, userName, userPasswd);
       shell.send(stopFirewall);
       shell.send("exit\n");
       shell.expectClose();
    } catch (IOException | TimeoutException | ExpectJException e) {
          String errMsg = "Failed to disable firewall of " + ip + " machine";    
}

但是我收到以下错误消息:

**java.io.IOException: Unable to establish SSH session/channel**
**Connection refused: connect**

0 个答案:

没有答案