Discussion:
[JSch-users] Execute ssh cmd on remote host
Michael Hekel
2015-04-30 09:21:53 UTC
Permalink
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
Atsuhiko Yamanaka
2015-04-30 11:17:27 UTC
Permalink
Hi,

On Thu, Apr 30, 2015 at 6:21 PM, Michael Hekel <***@gmx.de> wrote:
> I'm succesfully connecting with Jsch to our ssh jump server.
> From there I would like to run a ssh cmd. I'm able to run simple commands
> like "ls" but get the following errors if I run "ssh hostX ls" (where hostX
> is a valid ip).
>
> System.err﹕ Permission denied, please try again.
> System.err﹕ Permission denied, please try again.
> System.err﹕ Permission denied
> (publickey,gssapi-keyex,gssapi-with-mic,password).

Try "ssh -v -v -v hostX ls"

Sincerely,
--
Atsuhiko Yamanaka
JCraft,Inc.
1-14-20 HONCHO AOBA-KU,
SENDAI, MIYAGI 980-0014 Japan.
Tel +81-22-723-2150
Skype callto://jcraft/
Twitter: http://twitter.com/ymnk
Facebook: http://facebook.com/aymnk
Michael Hekel
2015-04-30 14:13:11 UTC
Permalink
> On Thu, Apr 30, 2015 at 6:21 PM, Michael Hekel <***@gmx.de> wrote:
>> I'm succesfully connecting with Jsch to our ssh jump server.
>> From there I would like to run a ssh cmd. I'm able to run simple commands
>> like "ls" but get the following errors if I run "ssh hostX ls" (where hostX
>> is a valid ip).
>>
>> System.err﹕ Permission denied, please try again.
>> System.err﹕ Permission denied, please try again.
>> System.err﹕ Permission denied
>> (publickey,gssapi-keyex,gssapi-with-mic,password).
>
> Try "ssh -v -v -v hostX ls"

Thanks. This helped understand the issue. I had to turn on agent forwarding:
((ChannelExec) channel).setAgentForwarding(true);

Regards,
Michael
Loading...