jsch

Configuring known_hosts in jgit

偶尔善良 提交于 2019-12-04 06:36:14
Using jgit with gitolite for source control, I have an application that generates certain code on command and which we want to be committed to source control. The goal is to pull with a fast forward, commit the new code, and then push it. I have the following method: private void commitToGitRepository(String updateComment, Config config) throws IOException, NoFilepatternException, GitAPIException { if(git == null) { git = Git.open(new File(config.getDpuCheckoutDir())); } PullCommand pull = git.pull(); pull.call(); } This method fails on the pull.call() method call, with the following exception

Failed to remotely execute R script which loads library “rhdfs”

南笙酒味 提交于 2019-12-04 05:11:01
问题 I'm working on a project using R-Hadoop, and got this problem. I'm using JSch in JAVA to ssh to remote hadoop pseudo-cluster, and here are part of Java code to create connection. /* Create a connection instance */ Connection conn = new Connection(hostname); /* Now connect */ conn.connect(); /* Authenticate */ boolean isAuthenticated = conn.authenticateWithPassword(username, password); if (isAuthenticated == false) throw new IOException("Authentication failed."); /* Create a session */ Session

what's the exact differences between jsch ChannelExec and ChannelShell?

南楼画角 提交于 2019-12-04 04:28:43
Can someone tell me the differences between ChannelExec & ChannelShell ? The shell and exec channels are quite similar - both execute commands with the remote shell (at least, conceptually - the server might be configured to treat them differently, of course). RFC 4254 groups them in the section "Interactive Sessions" , and they both (as well as subsystem, see below) use the channel type "session" in the SSH protocol. There is one important difference: For ChannelShell , the input stream provides both the commands and input to these commands. This is like using an interactive shell on your

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

一世执手 提交于 2019-12-04 04:26:18
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, though. $ java -cp clojure.jar:clojure-contrib.jar:com.jcraft.jsch_0.1.31.jar clojure.main Clojure 1.1.0 user=> (require 'com.jcraft.jsch) java.io.FileNotFoundException: Could not locate com/jcraft/jsch__init.class or com/jcraft/jsch.clj on classpath: (NO_SOURCE_FILE

How to use Java JSch library to read remote file line by line?

做~自己de王妃 提交于 2019-12-04 03:05:06
I am trying to use Java to read a file line by line, which is very simple (there are multiple solutions for this on stackoverflow.com), but the caveat here is that the file is located on a remote server, and it is not possible to get a local copy (it is a massive collection of millions of Amazon reviews in a single .txt file). JSch comes with two example classes that copy files to and from remote hosts, namely ScpTo and ScpFrom. I am interested in reading the file from the remote host line by line; ScpFrom would try to copy the whole thing into a local file, which would take ages. Here is a

JSCH sudo su command “tty” error

只愿长相守 提交于 2019-12-04 02:59:18
问题 Java - Jsch sudo command. I am using Jsch and my task is to login to server and run command as following sudo su - bumboo Using following code i am successfully able to connect but when i try to run command it gives me error sudo: sorry, you must have a tty to run sudo Following is my code public static Channel sudoBamboo(Session session, String sudo_pass) throws Exception { ChannelExec channel = (ChannelExec) session.openChannel("exec"); //SUDO to bamboo user String command = "sudo su -

Creating JSch HostKey instance from a public key in .pub format

倾然丶 夕夏残阳落幕 提交于 2019-12-04 02:21:56
问题 I am trying to send a file from a Windows machine to a Linux machine using JSch. Because of that I copied the host public key from the Linux machine to my Windows machine and added the key to my HostKeyRepository . But for some reason I get "invalid key type" exception. Here is my code: HostKeyRepository repo = jsch.getHostKeyRepository(); File file = new File("D:\\Uni\\Arbeit\\ssh_host_rsa_key.pub"); byte[] HK = Files.readAllBytes(file.toPath()); Session session=jsch.getSession(user, host,

Creating nested directories on server using JSch in Java

对着背影说爱祢 提交于 2019-12-04 01:49:08
问题 I am making an application for file uploading in Java using jSch . I want to put my file in different directories based on their creation date etc. I have a main directory "/var/local/recordingsbackup/" in which I am creating other directories and putting data in them. To achieve this: I have to create Dir'y like "/var/local/recordingsbackup/20140207/root/SUCCESS/WN/" and put data in it. I've tried this so far: private void fileTransfer(ChannelSftp channelTarget, temp_recording_log recObj,

DHGEX failing with 2048-bit key under Java 8, but succeeding with 1024-bit key

北城余情 提交于 2019-12-04 01:44:47
问题 I'm using JSCH 0.1.53 to connect to a remote SSH server, which uses a 1024-bit RSA key. We are able to connect successfully to the remote server when we also use a 1024-bit RSA key, but when we generated stronger 2048-bit keys we stopped being able to connect. We got an error message that reads "prime size must be multiple of 64, and can only range from 512 to 2048" and that originates from a call to DHGEX.java (Diffie-Hellman Group EXchange). We're running Java 1.8, and the error message

teamcity aes256-cbc error when retrieving git repository

旧城冷巷雨未停 提交于 2019-12-04 00:39:14
I've just installed Teamcity 8.0.3 on a fresh Windows Server 2012 machine. Installation was successful, and I'm trying to configure an agent in order to fetch a project stored in a git server. This server uses a ssh key. I've added it to my agent, but when it tries to retrieve the project this error appears. Failed for the root 'rtogit' #1: List remote refs failed: com.jcraft.jsch.JSchException: The cipher 'aes256-cbc' is required, but it is not available. I've seen, for example here that I must change my policy, but I'm not a java expert and I don't know what I must do. Can someone help me