j2ssh

SSH connection using Java

筅森魡賤 提交于 2020-02-20 05:28:50
问题 I am trying to establish an SSH connection through my Java code, but getting below exception .. I tested my connection through Putty/Winscp tools and it works fine. The problem is with my Java code... SEVERE: The Transport Protocol thread failed java.io.IOException: The socket is EOF at com.sshtools.j2ssh.transport.TransportProtocolInputStream.readBufferedData(Unknown Source) at com.sshtools.j2ssh.transport.TransportProtocolInputStream.readMessage(Unknown Source) at com.sshtools.j2ssh

sshtools.SftpClient.put failing with “No such file”

白昼怎懂夜的黑 提交于 2020-01-16 18:55:08
问题 I've inherited a Java based project that includes a cron job to upload a file via SFTP to a third-party server. Here's the relevant code. String filePath = IUtil.getInstance().getProperties("cheetah_sftp_filepath"); try{ SshClient ssh = new SshClient(); ssh.connect(host, port); //Authenticate PasswordAuthenticationClient passwordAuthenticationClient = new PasswordAuthenticationClient(); passwordAuthenticationClient.setUsername(userName); passwordAuthenticationClient.setPassword(password); int

Send command via ssh and read ouput results

本秂侑毒 提交于 2019-12-01 12:55:07
问题 I have code to connect to a remote server via ssh and send 2 or more commands to it (for example: cd /export/home/ops/bin and "./viewlinkload –time 20131205-19") but I don't see the command executed and don't receive results. I need to get the result returned from server and display it. This is code send command: try { command = "cd /export/home/ops/bin"; command1="./viewlinkload –time 20131205-19"; session.startShell(); session.getOutputStream().write(command.getBytes()); ChannelInputStream