jsch

How to Map System.out and System.in to SWT controls

浪尽此生 提交于 2019-12-11 10:01:31
问题 I am working on on a tool to connect to a remote server using jcraft.JSch (ssh to Unix server) and return the output and display its output. The script works fine when channel input outputs are System.in and System.out . But when I try with SWT controls, it is not able to display the exact output I am getting with System.out read from SWT Text control emulating System.in public void create() { dialogShell = new Shell(dialogShell, SWT.PRIMARY_MODAL | SWT.SHEET | SWT.RESIZE); GridLayout

how to force unclosed Jsch ssh connections to close

孤街浪徒 提交于 2019-12-11 08:03:35
问题 I'm using Jsch and expectit to connect to network devices and update configs, change passwords, etc... I am having a problem where loopback connections remain open which prevents more ssh sessions from being created. I read that this is a problem with certain versions of OpenSSH and that the solution is to upgrade the sshd. Unfortunately this sometimes isn't an option when connecting to network appliances. Is there no workaround? EDIT - Here's my code - aren't I closing everything manually?

How to use all the Unix environment variables?

▼魔方 西西 提交于 2019-12-11 07:40:52
问题 Using Java (JSch API) I am trying to execute an Unix command on a remote machine. Now, to successfully execute this command I need to use all the environment variables already set on the remote box. I can use export <variable> command to set the variables on runtime. But as the number of such variables is quite large I am wondering if there is any better way to use the variables in runtime. Can anyone help please or should I explain a bit more? 回答1: You can save variables into a file: set >

JSCH execute command on windows machine and take the output

雨燕双飞 提交于 2019-12-11 05:07:25
问题 Here i am executing command on remote windows server from my local windows machine with below code . But i am getting error as "Unable to execute command or shell on remote system: Failed to Execute process." can anybody help me here to come out of this problem? String user = username; String pass = password; String host = ip; JSch jsch = new JSch(); Session session = jsch.getSession(user, host, 22); java.util.Properties config = new java.util.Properties(); config.put("StrictHostKeyChecking",

jsch - send special keys (CTRL-C, CTRL-D, etc.)

人盡茶涼 提交于 2019-12-11 04:02:35
问题 I need to send special keys to a remote terminal, how can I do that with JSCH? Thanks, Walter 回答1: Try sending two bytes: 0x03, 0x04. Check ASCII table for more. 回答2: I switched to sshj and use the signal enumeration to send signals, if needed. Walter 回答3: You can send a signal like this: channel.sendSignal("2"); // sends (CTRL+C) signal 来源: https://stackoverflow.com/questions/4167818/jsch-send-special-keys-ctrl-c-ctrl-d-etc

How to run “pbrun pbapp wasapp=ksh” command using SSH java client?

回眸只為那壹抹淺笑 提交于 2019-12-11 03:52:02
问题 I want to connect to a ssh server. I tried Jsch, Orion, J2ssh java api's to connect. I could able to run commands like date, pwd,who etc. But for my purpose, i need to use " pbrun pbapp wasapp=ksh " command. Then only, i can use my remaining commands on the server. Please let me know, how to use this command over java. 来源: https://stackoverflow.com/questions/10201946/how-to-run-pbrun-pbapp-wasapp-ksh-command-using-ssh-java-client

JSchException: Algorithm negotiation fail diffie-hellman-group14-sha1

♀尐吖头ヾ 提交于 2019-12-11 03:09:13
问题 I know this has been asked a few times but I have tried many of the accepted solutions already given. I am creating a simple SSH tunnel using JSch. and I keep getting this error along with this in the logs: INFO: diffie-hellman-group14-sha1 is not available. I have already added the Java unlimited policy files to the correct folder and I have added this algorithm to the KexAlgorithms section in the sshd_config file. Below is the full log breakdown. INFO: Connecting to xx.xx.xxx.xxx port 22

com.jcraft.jsch.JSchException: Auth fail

 ̄綄美尐妖づ 提交于 2019-12-11 02:21:45
问题 While I upload a file from local disk to a remote server,such exception occured: com.jcraft.jsch.JSchException: Auth fail at org.apache.tools.ant.taskdefs.optional.ssh.Scp.execute(Scp.java:215) I am sure that the userid and password is correct.Because I can upload any file after I restart the upload thread without modify configuration. Is it possible that this exception is caused by bad network between my machine and server?Or any other cause? 回答1: EGit (even latest version 3.3.2) does not

JSchException: UnknownHostKey

时间秒杀一切 提交于 2019-12-11 01:18:23
问题 I'm trying to use Jsch to establish an SSH connection in Java. I have set "StrictHostKeyChecking" to yes. I understand that the hostkey of the server has to be obtained before hand and store in the hostkey file before the first attempt to connect to the server. How can I get the HostKey of the server. My code produces the following exception: com.jcraft.jsch.JSchException: UnknownHostKey: ASY-PC RSA key fingerprint is 22:fb:ee:fe:18:cd:aa:9a:9c:78:89:9f:b4:78:75:b4 How can I make connection

Idea regarding sudo su - user - in jsch

浪尽此生 提交于 2019-12-11 01:09:24
问题 I am having problems with using sudo su in jsch, below is my post(exec.java): package com.test; import com.jcraft.jsch.*; import java.awt.*; import javax.swing.*; import java.io.*; public class Exec{ public static void main(String[] arg){ try{ JSch jsch=new JSch(); String host=null; if(arg.length>0){ host=arg[0]; } else{ host=JOptionPane.showInputDialog("Enter username@hostname", "username"+ "@hostName"); } String user=host.substring(0, host.indexOf('@')); host=host.substring(host.indexOf('@'