jsch

How to set KEX on JSch Session when using Apache VFS

若如初见. 提交于 2019-12-01 06:41:59
I am using Apache VFS 2.1 with JSch 0.1.54 (latest versions today) to upload files using SFTP. The system throws "End of IO Stream Read" when connecting, the complete stack is: Caused by: com.jcraft.jsch.JSchException: Session.connect: java.io.IOException: End of IO Stream Read at com.jcraft.jsch.Session.connect(Session.java:565) at com.jcraft.jsch.Session.connect(Session.java:183) at org.apache.commons.vfs2.provider.sftp.SftpClientFactory.createConnection(SftpClientFactory.java:166) I've found a possible solution to my problem in this thread but it operates directly with the JSch. Since I am

Loading private key from string or resource in Java JSch in Android app

一曲冷凌霜 提交于 2019-12-01 06:40:58
I'm writing an app which is supposed to access my private server via SSH using JSch. Since I have set up public key authentication I want this app to authenticate the same way. I will be the only one using this app so I want to store my key either directly inside the app (e.g. hard-coded) or separated somewhere inside the home directory of my phone. Which would be the best way to store it, maybe as a resource file inside the project? Since I'm pretty new to Android development I'm not sure about what's the best way for this. What I've tried: // [...] String user = "my_user"; String ssh_pwd =

Calling a shell script using SSH exec channel, but it ignores calls to other shell scripts

只谈情不闲聊 提交于 2019-12-01 06:39:06
问题 I am managing to execute a shell script on a remote server using JSch exec using the helpful examples provided here. I can see the echoes being returned from the script and the exit status at the end is 0 - so all looks good at first glance. However, the problem is that the script itself calls out to other scripts, and these appear to be completely ignored, just skipped over. The script calls other scripts directly. i.e. the first line of the script is something like: script_two.sh Could

can I re-add remote host to known_host using JSCH?

試著忘記壹切 提交于 2019-12-01 06:25:01
问题 I want to be able to remove the remote server key from known_hosts and add it again. The remote server gets updated often so I want to automatically remove the remote host key and add its new key to known_hosts. I can remove the key from known_hosts though it is clunky and uses a Process instead of going through JSCH. This works but I encounter this message whenever I try to access the server: The authenticity of host '192.168.1.1 (192.168.1.1)' can't be established. RSA key fingerprint is 10

Set Directory Permissions CHMOD with JSCH

眉间皱痕 提交于 2019-12-01 06:19:22
In Unix, how do I set the directory permissions with JSCH? I am looking to do drwxrwxrwx. Filezilla says the integer for that is 775 but JSCH is not setting the permissions correctly. After JSCH sets the permissions Filezilla says that it is 407. The file permissions code in Unix ( 777 , for example) are octal, not decimal. As in: when you do something like chmod -R 777 , the digits are interpreted as octal input instead of decimal input. This system comes from the fact that there are 3 permission groups: owner group world and each group has an "on/off bit" for: read write execute so octal

Loading private key from string or resource in Java JSch in Android app

纵然是瞬间 提交于 2019-12-01 05:46:07
问题 I'm writing an app which is supposed to access my private server via SSH using JSch. Since I have set up public key authentication I want this app to authenticate the same way. I will be the only one using this app so I want to store my key either directly inside the app (e.g. hard-coded) or separated somewhere inside the home directory of my phone. Which would be the best way to store it, maybe as a resource file inside the project? Since I'm pretty new to Android development I'm not sure

Set Directory Permissions CHMOD with JSCH

懵懂的女人 提交于 2019-12-01 03:56:52
问题 In Unix, how do I set the directory permissions with JSCH? I am looking to do drwxrwxrwx. Filezilla says the integer for that is 775 but JSCH is not setting the permissions correctly. After JSCH sets the permissions Filezilla says that it is 407. 回答1: The file permissions code in Unix ( 777 , for example) are octal, not decimal. As in: when you do something like chmod -R 777 , the digits are interpreted as octal input instead of decimal input. This system comes from the fact that there are 3

JSch how to use with PuTTY private key

扶醉桌前 提交于 2019-12-01 01:04:38
I'm trying to use JSch with a private key configuration. I've generated a public and private key using PuTTYgen but am unsure what to do with both of the files. Which key (public/private) needs transferring to the server? First, you need to register your PuTTYgen-generated public key on the server. See Getting ready for public key authentication or (my) Set up SSH public key authentication . And finally see Can we use JSch for SSH key-based communication? for details on using the private key in JSch. Make sure you use the latest version of JSch, as older versions do not support the .ppk format

JSch Exec output for error

故事扮演 提交于 2019-12-01 00:34:11
I need to run shell script at a remote machine. I am using JSch to connect to the remote machine and executing the shell script using ChannelExec . I need to know how I can get to know, if there was any error while execution of the command. Following is my code ChannelExec channel = (ChannelExec) session.openChannel("exec"); BufferedReader in = new BufferedReader(new InputStreamReader(channel.getInputStream())); String command = scriptName; if(parameter != null && !parameter.isEmpty()){ command += " " + parameter; } LOGGER.debug("Command To be Executed: " + command); channel.setCommand(command

Getting MD5 checksum on the remote server using JSCH

偶尔善良 提交于 2019-12-01 00:26:01
I am writing a application where the requirement is to transfer files from a remote SFTP server to the local machine and vice - versa. During the file transfer I want to make sure that no data packets are lost and corrupted in the transit.So the idea is to run a MD5 checksum on the remote file (residing in the sftp server) before the transfer and then start the transfer process. Once the transfer is done, run a md5 on the local file and compare the two checksums. I am using JSCH to connect to sftp server and the code is in java.But I dont know how to run a md5 on the remote file residing in