A typical event was encountered in the recent project when Rhel's SELinux was set to disable
Using Java's Jsch library to invoke the SSH command will randomly return an empty string, the version I used is 0.1.49, and the latest version 0.1.51 is not tested.
About jsch:http://www.jcraft.com/jsch/
To this end, I specifically wrote a program test:
Package Com.ibm.leo;import Com.ibm.gts.cms.common.guestssh.api.guestsshservicefactory;import Com.ibm.gts.cms.common.guestssh.api.iguestsshproperties;import Com.ibm.gts.cms.common.guestssh.api.iguestsshservice;import Com.ibm.gts.cms.common.guestssh.api.IScriptResponse ;p Ublic class Guestssh {/** * This code snippet would validate that the GUESTSSH service remove execute would return Null randomly if the selinux was disabled. * */public static void Main (string[] args) {try{int sshrc=-1;if (args.length<3) {System.out.println ("Usage:java-jar Testssh.jar The test results are as follows:
D:\tmp>java-jar Testssh.jar 192.168.1.244 hostname 5start test ... Exceute count:1 returncode:0 return lines:1command return:gmtdevexceute count:2 returncode:0 return Lines : 1Command return:exceute count:3 returncode:0 return lines:1command return:exceute count:4 returncode:0 return Lines:1command return:exceute count:5 returncode:0 return lines:1command return:gmtdevend test, the total exe Cute count is 5, and first line null return count Is:3
As can be seen from the results, a total of 5 host names, only two get, 3 times Although the command executes successfully, but returns a null value, this situation only occurs when selinux=disabled, and enforcing and permissive return values are normal.
Maybe it's a bug in Guestssh? Record for reference.
SELinux set As a case of disable affecting Java SSH Toolkit Jsch 0.1.49.jar