SELinux set As a case of disable affecting Java SSH Toolkit Jsch 0.1.49.jar

Source: Internet
Author: User
Tags stdin

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.