How can I connect to an SSH server in Java? I don\'t need/want a shell. I just want to connect to the SSH server and get the content of, say, file.txt. How can
file.txt
I used this and worked for me
Channel channel=session.openChannel("exec"); String command = "Your Command here"; ((ChannelExec)channel).setCommand(command); InputStream in=channel.getInputStream(); ((ChannelExec)channel).setErrStream(System.err); channel.connect();