I tried this trick... but when I execute the command:

su -c 'command' user < 'password'

it still searches the file 'password' for input.
On the other end, if I execute

su -c 'command' user

it prompts for password but doesn't read it from the channel's InputStream
or by using the methods of my UserInfo object...
I'm afraid that what I want to do can only be done with server-side
configurations...

Il giorno 14 marzo 2012 17:11, Chad Kellerman <sunck...@gmail.com> ha
scritto:

> Looks like channel.setPty(true) should do the trick.
>
>
>
> On Wed, Mar 14, 2012 at 12:01 PM, Chad Kellerman <sunck...@gmail.com>wrote:
>
>> there is a ssh config option to force psuedo tty allocation.  Add that to
>> your config for the ssh connection.
>>
>>
>>
>> On Wed, Mar 14, 2012 at 11:50 AM, Simone Battagliero <
>> s.battagli...@googlemail.com> wrote:
>>
>>> I tried, but it seems to be not supported in my OS... I have Red Hat
>>> 4.1.2-51 with 2.6.18 kernel.
>>> I also tried su -c "Command" < "/path/to/file" but it says "standard in
>>> must be a tty".
>>> Thank you
>>>
>>> Il giorno 14 marzo 2012 15:58, Chad Kellerman <sunck...@gmail.com> ha
>>> scritto:
>>>
>>> Try:
>>>>
>>>> *su -c "Command" < "Password"
>>>>
>>>> That may work depending on the remote host OS and su version.  I've
>>>> used it with recent versions of Linux.
>>>> *
>>>>
>>>>
>>>> On Wed, Mar 14, 2012 at 10:43 AM, Simone Battagliero <
>>>> s.battagli...@googlemail.com> wrote:
>>>>
>>>>> Hi,
>>>>> I'm using JSch to login into a remote shell and execute commands in
>>>>> it, and I have no general problems. However, when I try to execute the 
>>>>> "su"
>>>>> command, I see the password prompt "Password: " in the standard output, 
>>>>> but
>>>>> I can't figure out how to insert that password with JSch. Apparently, no
>>>>> method of the interfaces UserInfo and UIKeyboardInteractive is called 
>>>>> after
>>>>> the prompt. Perhaps particular settings are required... can somebody help
>>>>> me?
>>>>> Thanks,
>>>>>
>>>>> Simone
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Virtualization & Cloud Management Using Capacity Planning
>>>>> Cloud computing makes use of virtualization - but cloud computing
>>>>> also focuses on allowing computing to be delivered as a service.
>>>>> http://www.accelacomm.com/jaw/sfnl/114/51521223/
>>>>> _______________________________________________
>>>>> JSch-users mailing list
>>>>> JSch-users@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/jsch-users
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> A grasshopper walks into a bar and the bartender says "Hey, we have a
>>>> drink named after you." And the grasshopper says "Really, You have a drink
>>>> named Murray?"
>>>>
>>>
>>>
>>
>>
>> --
>> A grasshopper walks into a bar and the bartender says "Hey, we have a
>> drink named after you." And the grasshopper says "Really, You have a drink
>> named Murray?"
>>
>
>
>
> --
> A grasshopper walks into a bar and the bartender says "Hey, we have a
> drink named after you." And the grasshopper says "Really, You have a drink
> named Murray?"
>
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
JSch-users mailing list
JSch-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to