I could set a reverse SSH connection and I've also added an identity using addIdentity(String, byte[] privatekey, byte[] publickey, byte[] passphrase);
However, even adding the public key using this method I could not login using the corresponding private key to the Android device because it cannot find the public key.
The device is not rooted, and here are the SSH debug messages:
% ssh -vvv -p 4545 -i /home/local_username/.ssh/identity_key jsch_username@localhost
OpenSSH_6.7p1 Debian-5, OpenSSL 1.0.1k 8 Jan 2015
debug1: Reading configuration data /home/local_username/.ssh/config
debug1: /home/local_username/.ssh/config line 1: Applying options for
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for
debug2: ssh_connect: needpriv 0
debug1: Connecting to localhost [127.0.0.1] port 4545.
debug1: Connection established.
debug1: identity file /home/local_username/.ssh/identity_key type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/local_username/.ssh/identity_key-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.7p1 Debian-5
ssh_exchange_identification: Connection closed by remote host
The relevant lines seems to be:
debug1: identity file /home/local_username/.ssh/identity_key type 1
debug1: key_load_public: No such file or directory
I do not have this folder set at the Android device as it is not rooted. Also I'd expect jsch to use the public key provided with addIdentitiy() method.
What I'm doing wrong?