Android Question SSH via jkSSH2 library

Phil Thompson

Member
Licensed User
Longtime User
I am trying to make an SSH connection to a raspberry pi via the jkSSH2 libary. I found some samples which all fail with the current B4A package

SSH2.initialize("SSH", "pi-star5", 22)
SSH2.authenticateWithPassword("pi-star", "raspberry")

>>> [SSH]: Connection was closed. Reason: There was a problem during connect.

This is an old library, are there any newer alternatives
 

drgottjr

Expert
Licensed User
Longtime User
works for me. android 15. does your sshd allow authenticatewithpassword? mine does not, so test failed. when i restarted sshd and allowed authenticationwithpassword, the test worked...
 
Upvote 0

Phil Thompson

Member
Licensed User
Longtime User
The parameters that I show in my example, are what I use with android juice, and with putty on my laptop to access the raspberry pi. Both work fine.
 
Upvote 0

Phil Thompson

Member
Licensed User
Longtime User
Oooppss...
It appears that the first time putty connects to the raspberry pi, a key is created which allows the connection and only the username and password is required after that point.

Does the jkSSH2 library have the capability to generate this key.
It does have the authenticate with key option, but how do I get this key
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
yeah, i saw that. as you've pointed out, the library is old, and the author appears to have moved on (actually, the library is 20 years old! our
wrapper only 13 or so). the library consists of 2 parts: the actual ssh client code (ch.ethz.ssh2) and a wrapper. the wrapper only wraps part of
what is available. you can read about the ssh client code here:

you would need javaobject or reflection to get at the code. i hate to leave you hanging, but ssh on android has little interest to me (given the
number of terminal apps available). i took a look at a couple other libraries, but they would need to be wrapped and would require some work.

if you're comfortable working with javaobject or reflection, you can easily see the methods which are actually available in the library but which are
not wrapped. it could be trivial to use them. while the library doesn't appear to be able to generate a key, that can be done elsewhere. the library
does support authenticating with a key, so if you have the key, you could feed it to that method (from a file stored on your device). the library also
supports interactive keyboard which might offer possibilities. it also supports querying the server as to which methods of authenitication it supports.

side note: the original library was consumed by google (as is often the case)
 
Upvote 0

Phil Thompson

Member
Licensed User
Longtime User
Thankyou for the info
It looks like this is now a dead issue. I don't have the skills to proceed as you suggested
and this app would need to connect to multiple sites with no server pre-configuration.

Again Thanks for the response
 
Last edited:
Upvote 0
Top