0

I have 5 hosts - A, B, C, D and E. A and B are windows hosts. C, D and E are Linux machines running ssh server on port 22.

I've copied plink.exe (putty command line backend client) in host B. When I run the command - plink user@host -pw password "command to execute" in a command prompt in B, it connects, executes the command and returns the output to the screen.

I'd like to start a ssh session to C, by executing plink.exe on B from a remote host A and keep it active until A closes the connection. Is this possible? Or Am I dumb that this cannot be done...

What i trying to do here is control how the connections are being made to linus ssh hosts. Instead of having multiple plink sessions in different machines, i'd like to have a single copy of plink in host B. Using a custom developed client, i'll direct the commands to B, where the plink session starts, executes the commands as long as the client is connected from the remote host and closes the session once the client is closed.

Is this possible? Please advise. Thanks.

0

I would use Sysinternals PSExec to connect from A to B, launching a remote command prompt. Then from the command prompt, run your Plink commands to connect and then later disconnect from C's ssh service.

you can connect from A to B (assuming you are on a useraccount with the smae name and password) with:

psexec \\B cmd

The window will switch to B's command prompt, which you can confirm with hostname. Then run your plink commands.

The only draw back is that you need to keep the remote command prompt on A open, unless you want to run the command to launch plink in the background as described here. If run in the background, you will have to reconnect with psexec to B, and run the plink disconnect command.

Edit: @JulianKnight has suggested a means to use Powershell instead of PSExec, which looks very promising if you are interested in native tools only. it does take some setup and configuration however, that is unnecessary with psexec. See link in comments below.

| improve this answer | |
  • Thanks Frank. If i dont want to use third party products, what is the best alternate way? Can i tunnel it to a service running in B? – vsathyan Mar 26 '15 at 15:48
  • well, SysInternals is a Microsoft property, so its not really third party. I don't really know of any other means to connect to a remote windows systems processing capacity, other than PSExec, RDP, or a custom written program. – Frank Thomas Mar 26 '15 at 15:52
  • You should be able to do this from PowerShell without an additional product. – Julian Knight Mar 26 '15 at 16:37
  • @JulianKnight, I'd be very interested in how, if you have a link. – Frank Thomas Mar 26 '15 at 16:40
  • I've not done it myself but I know it can be done. – Julian Knight Mar 26 '15 at 16:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.