I’m facing an issue when I try to connect to PostgreSQL Database after connected SSH successfully. I’m using Java + JSCH library to help connect to DB PostgreSQL via SSH tunnel. Please help to take a look on my code: An exception is thrown at following step: Here is result: I used value above to connect PostgreSQL manually, using pgAdmin4,
I want to be able to retrieve the host key of a remote SSH host using Java code. Is there any library that does this, I looked into JSch but couldn’t find what I wanted. I am aware that I can run the terminal command ssh-keyscan <hostname> through Java, but I want this to be the last resort. Seeking better
I want to read file extended attributes using com.jcraft.JSch 0.1.55 (the file is on SFTP server). I know that class SftpATTR actually does have a method but in my case it returns null. I see that in this code the last if-statement is responsible for reading extended attributes but it seems to me that it always evaluates to false, because
I referred the question Multiple bash commands and implemented as below. I am connecting to a device for which first command should be configure then only I will get a prompt to execute all other commands. I don’t get output for any of the commands and the control does not return. The following are the commands that work in terminal.
I am executing a cmd from jsch , once command is completed I need to show the command output. while reading the command output its taking long time and its ns not coming from the while loop even after execution of command. The following is my code: Answer I have added the exit command at the end of the command.
I’m trying to manage router via Java application using Jcraft Jsch library. I’m trying to send Router Config via TFTP server. The problem is in my Java code because this works with PuTTY. This my …
I am trying to execute a command on a Linux server using SSH from Android with JSch. As far as I know I am connecting to the server, but when I attempt to retrieve the results of the command I am getting nothing. Connect to server: Retrieve data: What am I missing here? Answer You disconnect immediately after you start
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 7 years ago. The community reviewed whether to reopen this question 23 days ago and left it closed: Not suitable for this site We don’t allow
I’m trying to write a Java code that can ssh into a Unix server and reset a user’s password. So I tried to implement some of the code found in SO. Eg. Sending commands to remote server through ssh …
I am using Jsch to tail a server-log. When I close my exec-channel and session, the “tail -f …” process still stays alive at server side. I tried to do channel.sendSignal(“KILL”) but it throws an exception: com.jcraft.jsch.JSchException: failed to send channel request how can I do a clean disconnect? Answer I know this is an old post but I’m posting