I have made some more progress.
I made another change by adding  trust="true"   below verbose="true"
the command  "touch somefile" ran successfully.

It is now hanging here  listening on port 4000.
[sshexec] cmd : java -Xdebug
-Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=y -jar
org.raspirecipes.helloworld-0.0.1-SNAPSHOT.jar
[sshexec] Listening for transport dt_socket at address: 4000


relevant Sample from  /home/zahid/Eclipse Java
Raspi/org.raspirecipes.helloworld/remotedebug.xml
--------------------------------------------------------------------------------------------------------------------------------------------

<echo> test sshexec touch somefile </echo>
<sshexec
host="${raspberrypi}"
username="${username}"
password="${password}"
verbose="true"
trust="true"
command="touch ~/raspirecipe/somefile" />

<echo> test sshexec touched somefile </echo>

    <sshexec
    host="${raspberrypi}"
             username="${username}"
             password="${password}"
             failonerror="true"
             usepty="true"
             verbose="true"
             trust="true"
             command="java -Xdebug
-Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=y -jar
${jar.filename}" />

-------------------------------------------------------------------------------------------

CONSOLE OUTPUT

Buildfile: /home/zahid/Eclipse Java
Raspi/org.raspirecipes.helloworld/remotedebug.xml
remotedebug:
     [echo] "Found application /home/zahid/Eclipse Java
Raspi/org.raspirecipes.helloworld/target/org.raspirecipes.helloworld-0.0.1-SNAPSHOT.jar"
     [echo] "Copying application to 192.168.0.22:
~/org.raspirecipes.helloworld-0.0.1-SNAPSHOT.jar"
      [scp] Connecting to 192.168.0.22:22
      [scp] done.
     [echo] "Starting
192.168.0.22:~/org.raspirecipes.helloworld-0.0.1-SNAPSHOT.jar
in debug mode"
     [echo]  test sshexec touch somefile
  [sshexec] Connecting to 192.168.0.22:22
  [sshexec] Connecting to 192.168.0.22 port 22
  [sshexec] Connection established
  [sshexec] Remote version string: SSH-2.0-OpenSSH_7.9p1 Raspbian-10+deb10u2
  [sshexec] Local version string: SSH-2.0-JSCH-0.1.54
  [sshexec] CheckCiphers:
aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
  [sshexec] CheckKexes:
diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
  [sshexec] CheckSignatures:
ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
  [sshexec] SSH_MSG_KEXINIT sent
  [sshexec] SSH_MSG_KEXINIT received
  [sshexec] kex: server: curve25519-sha256,curve25519-sha...@libssh.org
,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1
  [sshexec] kex: server:
rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519
  [sshexec] kex: server: chacha20-poly1...@openssh.com
,aes128-ctr,aes192-ctr,aes256-ctr,aes128-...@openssh.com,
aes256-...@openssh.com
  [sshexec] kex: server: chacha20-poly1...@openssh.com
,aes128-ctr,aes192-ctr,aes256-ctr,aes128-...@openssh.com,
aes256-...@openssh.com
  [sshexec] kex: server: umac-64-...@openssh.com,umac-128-...@openssh.com,
hmac-sha2-256-...@openssh.com,hmac-sha2-512-...@openssh.com,
hmac-sha1-...@openssh.com,umac...@openssh.com,umac-...@openssh.com
,hmac-sha2-256,hmac-sha2-512,hmac-sha1
  [sshexec] kex: server: umac-64-...@openssh.com,umac-128-...@openssh.com,
hmac-sha2-256-...@openssh.com,hmac-sha2-512-...@openssh.com,
hmac-sha1-...@openssh.com,umac...@openssh.com,umac-...@openssh.com
,hmac-sha2-256,hmac-sha2-512,hmac-sha1
  [sshexec] kex: server: none,z...@openssh.com
  [sshexec] kex: server: none,z...@openssh.com
  [sshexec] kex: server:
  [sshexec] kex: server:
  [sshexec] kex: client:
ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
  [sshexec] kex: client:
ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
  [sshexec] kex: client:
aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc
  [sshexec] kex: client:
aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc
  [sshexec] kex: client:
hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
  [sshexec] kex: client:
hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
  [sshexec] kex: client: none
  [sshexec] kex: client: none
  [sshexec] kex: client:
  [sshexec] kex: client:
  [sshexec] kex: server->client aes128-ctr hmac-sha1 none
  [sshexec] kex: client->server aes128-ctr hmac-sha1 none
  [sshexec] SSH_MSG_KEX_ECDH_INIT sent
  [sshexec] expecting SSH_MSG_KEX_ECDH_REPLY
  [sshexec] ssh_rsa_verify: signature true
  [sshexec] Permanently added '192.168.0.22' (RSA) to the list of known
hosts.
  [sshexec] SSH_MSG_NEWKEYS sent
  [sshexec] SSH_MSG_NEWKEYS received
  [sshexec] SSH_MSG_SERVICE_REQUEST sent
  [sshexec] SSH_MSG_SERVICE_ACCEPT received
  [sshexec] Authentications that can continue:
publickey,keyboard-interactive,password
  [sshexec] Next authentication method: publickey
  [sshexec] Authentications that can continue: password
  [sshexec] Next authentication method: password
  [sshexec] Authentication succeeded (password).
  [sshexec] cmd : touch ~/raspirecipe/somefile
  [sshexec] Disconnecting from 192.168.0.22 port 22
  [sshexec] Caught an exception, leaving main loop due to Socket closed
     [echo]  test sshexec touched somefile
  [sshexec] Connecting to 192.168.0.22:22
  [sshexec] Connecting to 192.168.0.22 port 22
  [sshexec] Connection established
  [sshexec] Remote version string: SSH-2.0-OpenSSH_7.9p1 Raspbian-10+deb10u2
  [sshexec] Local version string: SSH-2.0-JSCH-0.1.54
  [sshexec] CheckCiphers:
aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
  [sshexec] CheckKexes:
diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
  [sshexec] CheckSignatures:
ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
  [sshexec] SSH_MSG_KEXINIT sent
  [sshexec] SSH_MSG_KEXINIT received
  [sshexec] kex: server: curve25519-sha256,curve25519-sha...@libssh.org
,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1
  [sshexec] kex: server:
rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519
  [sshexec] kex: server: chacha20-poly1...@openssh.com
,aes128-ctr,aes192-ctr,aes256-ctr,aes128-...@openssh.com,
aes256-...@openssh.com
  [sshexec] kex: server: chacha20-poly1...@openssh.com
,aes128-ctr,aes192-ctr,aes256-ctr,aes128-...@openssh.com,
aes256-...@openssh.com
  [sshexec] kex: server: umac-64-...@openssh.com,umac-128-...@openssh.com,
hmac-sha2-256-...@openssh.com,hmac-sha2-512-...@openssh.com,
hmac-sha1-...@openssh.com,umac...@openssh.com,umac-...@openssh.com
,hmac-sha2-256,hmac-sha2-512,hmac-sha1
  [sshexec] kex: server: umac-64-...@openssh.com,umac-128-...@openssh.com,
hmac-sha2-256-...@openssh.com,hmac-sha2-512-...@openssh.com,
hmac-sha1-...@openssh.com,umac...@openssh.com,umac-...@openssh.com
,hmac-sha2-256,hmac-sha2-512,hmac-sha1
  [sshexec] kex: server: none,z...@openssh.com
  [sshexec] kex: server: none,z...@openssh.com
  [sshexec] kex: server:
  [sshexec] kex: server:
  [sshexec] kex: client:
ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
  [sshexec] kex: client:
ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
  [sshexec] kex: client:
aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc
  [sshexec] kex: client:
aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc
  [sshexec] kex: client:
hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
  [sshexec] kex: client:
hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
  [sshexec] kex: client: none
  [sshexec] kex: client: none
  [sshexec] kex: client:
  [sshexec] kex: client:
  [sshexec] kex: server->client aes128-ctr hmac-sha1 none
  [sshexec] kex: client->server aes128-ctr hmac-sha1 none
  [sshexec] SSH_MSG_KEX_ECDH_INIT sent
  [sshexec] expecting SSH_MSG_KEX_ECDH_REPLY
  [sshexec] ssh_rsa_verify: signature true
  [sshexec] Permanently added '192.168.0.22' (RSA) to the list of known
hosts.
  [sshexec] SSH_MSG_NEWKEYS sent
  [sshexec] SSH_MSG_NEWKEYS received
  [sshexec] SSH_MSG_SERVICE_REQUEST sent
  [sshexec] SSH_MSG_SERVICE_ACCEPT received
  [sshexec] Authentications that can continue:
publickey,keyboard-interactive,password
  [sshexec] Next authentication method: publickey
  [sshexec] Authentications that can continue: password
  [sshexec] Next authentication method: password
  [sshexec] Authentication succeeded (password).
  [sshexec] cmd : java -Xdebug
-Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=y -jar
org.raspirecipes.helloworld-0.0.1-SNAPSHOT.jar
  [sshexec] Listening for transport dt_socket at address: 4000





---------------------------------------------------------------------------------------

/home/zahid/Eclipse Java Raspi/org.raspirecipes.helloworld/remotedebug.xml
specifically line 31.

line 26 <sshexec
line 27 host="${raspberrypi}"
line 28 username="${username}"
line 29 password="${password}"
line 30 verbose="true"
line 31 command="touch somefile"/>
line 32 <echo> test sshexec touched somefile </echo>

-----------------------------------------------------------------------------------

and the contents of /home/zahid/Eclipse Java
Raspi/org.raspirecipes.helloworld/remotedebug.xml

specifically line 31?

________________________________
From: Zahid Rahman <zahidr1...@gmail.com>
Sent: Tuesday, January 12, 2021 11:12 AM
To: user@ant.apache.org <user@ant.apache.org>
Subject: test of <sshexec

I tested the <sshexec tag with the changes below ( touch somefile),
returns same error message of com.jcraft.jsch.JSchException: reject
HostKey: 192.168.0.22.

<?xml version="1.0" encoding="UTF-8"?>
<project name="deploy" default="remotedebug" basedir=".">
<property name="raspberrypi" value="192.168.0.22" />
<property name="raspberryfolder" value="~/raspirecipe" />
<property name="username" value="pi" />
<property name="password" value="raspberry" />

<target name="remotedebug">
<first id="jars">
<fileset dir="target" includes="**/*.jar" />
</first>
<pathconvert pathsep="," property="jar.path" refid="jars" />
<basename file="${jar.path}" property="jar.filename" />
<echo>"Found application ${jar.path}"</echo>

<echo>"Copying application to
${raspberrypi}:${raspberryfolder}/${jar.filename}"</echo>
<scp localfile="${jar.path}"
todir="${username}:${password}@${raspberrypi}:${raspberryfolder}"
trust="true" />

<echo>"Starting ${raspberrypi}:${raspberryfolder}/${jar.filename} in
debug mode"</echo>


<echo> test sshexec touch somefile </echo>

<sshexec
host="${raspberrypi}"
username="${username}"
password="${password}"
verbose="true"
command="touch somefile"/>

<echo> test sshexec touched somefile </echo>

<!--
<sshexec
host="${raspberrypi}"
username="${username}"
password="${password}"
failonerror="true"
usepty="true"
verbose="true"
command="java -Xdebug
-Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=y -jar
${jar.filename}" />
-->

</target>
</project>


Buildfile: /home/zahid/Eclipse Java
Raspi/org.raspirecipes.helloworld/remotedebug.xml
remotedebug:
[echo] "Found application /home/zahid/Eclipse Java
Raspi/org.raspirecipes.helloworld/target/org.raspirecipes.helloworld-0.0.1-SNAPSHOT.jar"
[echo] "Copying application to 192.168.0.22:
~/raspirecipe/org.raspirecipes.helloworld-0.0.1-SNAPSHOT.jar"
[scp] Connecting to 192.168.0.22:22
[scp] done.
[echo] "Starting
192.168.0.22:~/raspirecipe/org.raspirecipes.helloworld-0.0.1-SNAPSHOT.jar
in debug mode"
[echo] test sshexec touch somefile
[sshexec] Connecting to 192.168.0.22:22
[sshexec] Connecting to 192.168.0.22 port 22
[sshexec] Connection established
[sshexec] Remote version string: SSH-2.0-OpenSSH_7.9p1 Raspbian-10+deb10u2
[sshexec] Local version string: SSH-2.0-JSCH-0.1.54
[sshexec] CheckCiphers:
aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
[sshexec] CheckKexes:
diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
[sshexec] CheckSignatures:
ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
[sshexec] SSH_MSG_KEXINIT sent
[sshexec] SSH_MSG_KEXINIT received
[sshexec] kex: server: curve25519-sha256,curve25519-sha...@libssh.org
,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1
[sshexec] kex: server:
rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519
[sshexec] kex: server: chacha20-poly1...@openssh.com
,aes128-ctr,aes192-ctr,aes256-ctr,aes128-...@openssh.com,
aes256-...@openssh.com
[sshexec] kex: server: chacha20-poly1...@openssh.com
,aes128-ctr,aes192-ctr,aes256-ctr,aes128-...@openssh.com,
aes256-...@openssh.com
[sshexec] kex: server: umac-64-...@openssh.com,umac-128-...@openssh.com,
hmac-sha2-256-...@openssh.com,hmac-sha2-512-...@openssh.com,
hmac-sha1-...@openssh.com,umac...@openssh.com,umac-...@openssh.com
,hmac-sha2-256,hmac-sha2-512,hmac-sha1
[sshexec] kex: server: umac-64-...@openssh.com,umac-128-...@openssh.com,
hmac-sha2-256-...@openssh.com,hmac-sha2-512-...@openssh.com,
hmac-sha1-...@openssh.com,umac...@openssh.com,umac-...@openssh.com
,hmac-sha2-256,hmac-sha2-512,hmac-sha1
[sshexec] kex: server: none,z...@openssh.com
[sshexec] kex: server: none,z...@openssh.com
[sshexec] kex: server:
[sshexec] kex: server:
[sshexec] kex: client:
ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
[sshexec] kex: client:
ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
[sshexec] kex: client:
aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc
[sshexec] kex: client:
aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc
[sshexec] kex: client:
hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
[sshexec] kex: client:
hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
[sshexec] kex: client: none
[sshexec] kex: client: none
[sshexec] kex: client:
[sshexec] kex: client:
[sshexec] kex: server->client aes128-ctr hmac-sha1 none
[sshexec] kex: client->server aes128-ctr hmac-sha1 none
[sshexec] SSH_MSG_KEX_ECDH_INIT sent
[sshexec] expecting SSH_MSG_KEX_ECDH_REPLY
[sshexec] ssh_rsa_verify: signature true
[sshexec] Disconnecting from 192.168.0.22 port 22

BUILD FAILED
/home/zahid/Eclipse Java
Raspi/org.raspirecipes.helloworld/remotedebug.xml:31:
com.jcraft.jsch.JSchException: reject HostKey: 192.168.0.22


<http://www.backbutton.co.uk>

Reply via email to