jsch

scp via java

What is the best method of performing an scp transfer via the Java programming language? It seems I may be able to perform this via JSSE, JSch or the bouncy castle java libraries. None of these solutions seem to have an easy answer. ...

Accessing a git repository via ssh behind a firewall.

I would like to access (clone/push/pull) a private (via ssh) git repository while behind a corporate firewall that only allows http proxy access. I have written a robust Java (daemon) program (based on the JSCh class library) that will allow me to leverage local and remote port forwarding and I am hoping to leverage this but my brain hur...

com.jcraft.jsch.JSchException: UnknownHostKey

I don't know how SSH works and I think that's a simple question. How do I fix that exception: com.jcraft.jsch.JSchException: UnknownHostKey: mywebsite.com. RSA key fingerprint is 22:fb:ee:fe:18:cd:aa:9a:9c:78:89:9f:b4:78:75:b4 I know I should verify that key or something, but there is like zero documentation for Jsch. Here is my code...

ChannelSftp.disconnect() not working

Hi, I am using jcraft's jsch library to connect to SFTP server. for local testing im using core FTP mini sftp server. I have quartz job which runs on my jetty server. This job picks up files from SFTP server and saves it to database. This is working fine, however when i use the disconnect api, the connection still exists. These con...

any good jsch examples?

I'm trying to run a command over ssh with jsch, but jsch has virtually no documentation and the examples I've found via google are terrible. For example, this one doesn't show code for handling the output stream. And, this one using an ugly hack to know when to stop reading from the output stream. ...

Finding file size and last modified of SFTP file using Java

I'm using JSch to get files from an SFTP server, but I'm trying to figure out a way to only get the oldest file, and to make sure that it is not currently being written to. The way I imagine myself doing this is first finding which file in the specified remote folder is oldest. I would then check the file size, wait x seconds (probably a...

Trying to perform ftp using Jsch

I wrote following code to ftp a file: public boolean sendFile(String sourceFilename, String destFilename) { FileInputStream fis = null; Session session = null; try { JSch jsch = new JSch(); jsch.setKnownHosts("D:/sftpRoot/test"); // Create session session = jsch.getSession(this.user, this.host, 22); UserInfo userIn...

ant scp task through a proxy

I am trying to make an ant build file to remote copy a war file. Ant scp task uses a jsch library for remote copying. How do I make it work through a proxy, the jsch library clearly supports it. does not work for jsch. Jsch does not read environment variables like http_proxy is there another solution ? ...

com.jcraft.jsch.JSchException: Auth cancel

I'm trying to write an Ant script to retrieve an URL via port tunnelling. It works great when I use a password (the names xxxx'd out for privacy): <project default="main"> <target name="main"> <sshsession host="xxxx" username="xxxx" password="xxxx"> <LocalTunnel lport="1080" rhost="xxxx" rport="80"/> <sequenti...

Using 3rd party java libraries, like com.jcraft.jsch, with clojure

I'm experimenting with clojure and am trying to get a feel for using 3rd party libraries. I've been able to download some source, bundle it into a jar file with leiningen, put it in my classpath and (use 'lib.etc) in my script. I've also played around with the objects in java.lang.*. I haven't had any success with 3rd party java, th...

Jsch - change order of preferred cipher algorithm

I am new user for JSch and wonder if I can change the preferred order of encryption algorithms such as: instead of the blow configuration in Jsch.java: config.put("cipher.s2c", "aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-cbc,aes256-cbc"); I want to have a configuration like: config.put("cipher.s2c","3des-ctr,aes1...

SharpSSH Progress and Rename

VB2005 and SharpSSH. Using the library to connect to a remote server and copy a file. I have the process working fairly well but have some smaller things which I cant seem to resolve as documentation for the library is fairly thin. I have two routines working. One using the Tamir.SharpSsh class and the other using the Tamir.SharpSsh.jsc...

Detect jsch disconnection

Hi, how can i detect from the client that jsch session has beed disconnected by the server? ...

Process dies after Jsch exits

I have a shell script that starts tomcat using 'catalina.sh start'. This script runs fine and starts tomcat which stays up even if I exit from my ssh session. I am trying to invoke this script from Jsch shell = new JSch(); session = shell.getSession(user, host, SSH_DEFAULT_PORT); session.setConfig(config); session.setPassword(password)...

Looking for java SFTP modern library, not jsch

Hi, The "jsch" based implementation works for me. But it looks not modern one due to using Vector (old style Java collection). I found that the other implementations are less popular and not documented. Can you recommend implementation of SFTP library that he/she has good experience with it. Thanks. ...

JSch sftp Transfer Stripping Windows Line Endings

I think I understand the difference between ASCII mode and Binary mode on regular FTP transfers -- in Binary mode the file is copied exactly, and in ASCII mode the client may modify line endings (stripping the Carriage Return from Windows -> UNIX or adding it in the other direction). However, I thought that the SFTP protocol only support...