jsch

setConfig(Properties) in the type Session is not applicable for the arguments (String, String)”

岁酱吖の 提交于 2019-12-23 05:47:10
问题 This question has already been asked here: "The method setConfig(Properties) in the type Session is not applicable for the arguments (String, String)" more than a year ago but it doesn't have any answer and I have the same problem just now. Unfortunately I didn't find anything more on Google. import com.jcraft.jsch.*; import java.io.*; import java.util.Properties JSch jsch = new JSch(); String user = "myUserId"; String host = "myHost"; Session session = jsch.getSession(user, host, 22);

passwd in one command isn't working

折月煮酒 提交于 2019-12-23 05:19:21
问题 I developed a tool to send one-line commands to different linux machines in one shot using JSch (A java library used to communicating with other machines over ssh) So our client needs to change the password on ALL machines. Google helped me reach this point: echo -e "123\n123" | passwd username Where '123' is the new password. The command executes but this is ALWAYS the output: [root@QNA-XR1 ~]# echo -e "123\n123" | passwd Changing password for root New password: Retype password: passwd:

Error to connect to FileZilla server using JSch SFTP client

安稳与你 提交于 2019-12-23 04:50:38
问题 I'm trying to connect on SFTP using localhost configurations but I get the following error. But when I use the same configurations on FilleZilla it works perfect... At FilleZilla server: (000017)06/08/2019 09:26:20 - (not logged in) (127.0.0.1)> Connected on port 21, sending welcome message... (000017)06/08/2019 09:26:20 - (not logged in) (127.0.0.1)> 220-FileZilla Server 0.9.60 beta (000017)06/08/2019 09:26:20 - (not logged in) (127.0.0.1)> 220-written by Tim Kosse (tim.kosse@filezilla

How to execute linux command “dzdo su - john” through JSch java api and execute some commands like “ls -ltr” on that user

不想你离开。 提交于 2019-12-23 03:23:12
问题 I want to connect to the remote linux server using java jsch library and switch to another user using command dzdo su - john and I want to execute some commands on that user. I have tried several ways on this requirement but I am unable to do this could any one help on this. public static void main(String args[]) { String host="xxxxx.yyyy.com"; String user="user"; String password="password"; String command1="dzdo su - lucy"; try{ java.util.Properties config = new java.util.Properties();

Java JSchException: Auth cancel

旧时模样 提交于 2019-12-23 03:04:42
问题 I am currently seeing this issue when attempting to ssh into a box from using JSch. I have tested the connection using Cygwin and it connects seamlessly. I have generated the keypair and placed the Public key in authorized_keys file on the remote server. Below is an extract from the logs INFO: Next authentication method: publickey INFO: Authentications that can continue: keyboard-interactive,password INFO: Next authentication method: keyboard-interactive INFO: Authentications that can

Verify host key in JSch with public key in “SSH2 PUBLIC KEY” format (RFC 4716)

时光总嘲笑我的痴心妄想 提交于 2019-12-23 02:29:23
问题 I am facing a problem with UnknownHostKey: servername , when trying to verify the host key using: jsch.setKnownHosts("target/hostname_keys"); Is it possible to use hostkey file in SSH2 format that looks like this ---- BEGIN SSH2 PUBLIC KEY ---- AAAAB3NzaC1kc3MAAACBAKKQ7hwq7 ..... w5Uw== ---- END SSH2 PUBLIC KEY ---- with JSch? Is there some good libraries that can work with SSH2 keys? 回答1: JSch does not support public keys in this format. But it's easy to convert that to known_hosts format.

Query regarding com.jcraft.jsch.JSchException: UnknownHostKey: x.y.com. DSA key fingerprint is “ac:ew:…”

倾然丶 夕夏残阳落幕 提交于 2019-12-23 02:29:11
问题 I am getting below error while trying to connect to one of the windows server from AWS cluster. Caused by: com.jcraft.jsch.JSchException: UnknownHostKey: x.y.com. DSA key fingerprint is "ac:ew:..... Note: I generated the RSA keys using PuTTYgen, but every time it tries to connect it gives issue with DSA fingerprint. I referred multiple SO links but unable to get the right solution. Finally I tried below approach based on one of the posts. Get the session first time with StrictHostKeyChecking

List complete hierarchy of a directories at SFTP server using JSch in Java

折月煮酒 提交于 2019-12-23 00:52:26
问题 I want to display complete hierarchy of a directory at a remote location using JSch. The location has multiple folders and a folder may or may not have files. Code written by me (taken reference from SFTP Read all files in directory): sftpChannel.cd(remotePath); Vector<String> files = sftpChannel.ls("*"); List<String> ret=new ArrayList<>(); for (int i = 0; i < files.size(); i++) { Object obj = files.elementAt(i); if (obj instanceof com.jcraft.jsch.ChannelSftp.LsEntry) { LsEntry entry =

Randomly getting empty output while executing shell command via JSch

戏子无情 提交于 2019-12-22 18:24:34
问题 I am trying to execute below Linux command via JSch (space check command) using JSch: df -h -P |awk '{print $6" "$4}' |awk '{ if ($1 == "/On_Demand") {print}}' | awk '{print $2}' | awk '{ if ($1 ~ /M/) {print ($1*1)} else if($1 ~ /G/) {print ($1*1024)} else if($1 ~ /T/) {print ($1*1024*1024)} else if($1==0) {print ($1*1)} else if($1 ~ /K/) {print ($1/1024)} else {print ("-1")}}' Backup command: export ORACLE_HOME=/path/to/ora/home;export ORACLE_SID=sid;/U01/NEW_DEMO/path/to/ora/home/bin/expdp

Reverse SSH tunnel with JSCH Java [closed]

你离开我真会死。 提交于 2019-12-22 15:33:24
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . Is it possible to do a reverse ssh connection using JSCH? If it is not, is there any other pure Java library that I can use to do a reverse tunnel SSH connection? The command I want to mimic is similar than: ssh -fN -R 7000:localhost:22 username@yourMachine-ipaddress 回答1: There is an example gist that shows how