Skip to content
Advertisement

Tag: ssh

Retrieving host key of remote SSH server using Java

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

JSch SFTP connections getting stuck

We have a java 7 code base where we are using Apache commons vfs2 v2.2 which is using JSch-0.1.54 as sftp provider. Now, the use case is to transfer files to a remote host via sftp. But, every now and then, the file upload process gets stuck. After taking the thread dump of the application, we found both the threads

SSH password authentication in Java using jcraft JSch fails with “Auth fail” but command-line “ssh” works

My system’s OS is Ubuntu 18. I am trying to connect SFTP through Java jcraft JSch but facing this exception: com.jcraft.jsch.JSchException: Auth fail Below are working: From terminal using sftp works fine with username and password, no issues. From FileZilla also it is working fine. Maven Dependency: Output: Terminal command sftp -vvv output: sftp -o “PreferredAuthentications password” -vvv username@host Output:

how to execute remote commands using apache mina sshd

I am trying to execute remote commands on an SSHServer running on my local windows machine. I am able to run simple command like “whoami” but failing to run something like “java -version” or “dir” Here is my code so far, can you tell where I am going wrong? SSHServer.java SSHClient.java TestSSH.java here is the output for “whoami”: here is

JSch: Is there a way to expose user environment variables to “exec” channel?

I am trying to run commands which uses local Linux logical paths like cat $test_dir/test.dat, but the logical path $test_dir (which is a user environment variable) is not available via ChannelExec. But when I use interactive ChannelShell, I am able to see the user variables and the commands run fine on the interactive session. I can view system level environment

Providing input/subcommands to command executed over SSH with JSch

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 Java code: I get Line has an invalid autocommand ‘192.168.50.1’ The problem is how can I run those successive commands. Answer Calling ChannelExec.setCommand multiple times

Advertisement