how to chain logins?
i need to log in to one ssh, and from it i need to log to another. how do i pass the username and password for the seond login? when i pass ";
This is something I haven't tried yet and isn't officially supported. Do you have a full example that I could play with?
i need to login to a local account that does not allow ssh. so, i need to ssh into the machine (initial connection) and from it login to the local account.
a use case you can use for testing:
- create 2 account on a machine
- ssh to one account
- after login, ssh to secondAccount@localhost
looking at the source code, it seems like a command is run as a single transaction, and then closes the connection. you can still run several commands seperated by semi-colon (cd /home/ehud/dir/; ls -la) but that does not work for login, as the console expects an interactive response. it occuered to me one way that might work is to create a MultiCommand class which extends (or expands) Command, or which will hold a set of commands, and change SshClient.exec, to run through all the commands sequentially (in val channel = session.exec(command.command)). don't know if that is the right way, but i thought i might fork and try it...
Is this supported now?