Jsch with PK auth - Execute commands without login - Account SU only

Ettore
2013-12-03
2013-12-03
  • Ettore
    Ettore
    2013-12-03

    Hi everyone.

    I'm facing a challenge regarding the use of JSCH.

    When the account I'm trying to connect to via the PK auth mechanism, has the restriction SU only, I can only execute commands and not log onto the box.

    As far as I know, through JSCH API I do have to connect first to the box and then I can execute commands, which as I mentioned above it is forbidden in my case.

    Is there a way in JSCH to achieve the "ssh userName@hostName shellCommand" without having first issue "ssh userName@hostName" namely the connect method, and then at the prompt shell:command ?

    Thank you in advance.

    Regards.

    Linux RH E.E. 5 32bits