Skip to content
Advertisement

Tag: jsch

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

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

Advertisement