Secondary login

Jun 25, 2013 at 12:14 AM
Say I connect successfully to a remote host using one of the existing authentication methods. Then on that host I want to run commands, which might also generate password requests. How can I handle that case?
Jun 27, 2013 at 2:55 PM

I can capture the "Enter password: " phrase, but no matter what I then send back as the password in the ShellStream, it always fails the login. Does the password need to be formatted in some way or something?
Jul 9, 2013 at 5:15 AM
Please give some code!
Jul 10, 2013 at 5:40 PM
Is it really necessary to provide code? The problem seems pretty clear to me: If you run a command that itself will generate a password request, how would one handle that?

For instance, you use SshStream to log into a host, then try to ssh into another host from there.
Jul 10, 2013 at 7:12 PM
For SSH use portforwarding and open a New SshClient to the forwarded port.
For everything else (e.g. sudo) use expect und write the password to the stream.

Since you dont want to show some code i cant tell you what you are doing wrong.
And i wont do your work and write the code for you :P
All i can say the lib is capable to do this.
Jul 10, 2013 at 11:52 PM
OK thanks for the info. One example where this is a problem is when I run Perforce commands remotely. If the user's ticket doesn't exist or has expired, then it will ask for a password. It can happen at any time since the ticket has a limited lifetime.

The reason I'm not posting code is because I've tried so many different ways to do it now I would not even know what to post at this time. It seems like it would be a relatively common problem so asking how this is usually handled seems like a reasonable thing to do.