Skip to content
Advertisement

Tag: jsch

How to execute shell command using SFTP channel in JSch?

I am trying to list all *.xml files in the directory. I do a cd first and then was trying to execute: But not sure how exactly to do it. There were some example around the Exec channel but is there a way to do the find with SFTP itself? Answer Your requirements are conflicting. You cannot execute shell commands

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

My JSch session doesn’t execute command

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 by Java with JSch Take commands(password) from string and set as InputStream to Unix servers in Java (JSCH) Using JSch ChannelExec,

Kill process before disconnecting

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

JSchException: Algorithm negotiation fail

I am trying to connect to remote sftp server over ssh with JSch (0.1.44-1) but during session.connect(); I am getting this exception: Logs from JSch: I am able to log in to remote server with linux sftp command. I was trying to find any kind of clue in the internet but I failed. Debug output from linux sftp command: Answer

Advertisement