Discussion:
Problem using Plink remote commands
(too old to reply)
l***@triad.rr.com
2010-10-29 23:57:19 UTC
Permalink
I'm not sure this is the right place for this, but there doesn't seem to be a place to get help with Plink specifically.

I'm trying to write a batch file that will use Plink to tunnel to Server 1 via ssh, then use Plink's remote command function to tunnel from Server 1 to Server 2. Here's the code I'm using:

start D:\Temp\plink.exe -A -P [port] -D [host]:[port] [username]@[server1] ssh -p [port] [username]@[server2]

I should mention that when I log into Server 1 through Plink and then manually enter the ssh command, it works fine. I've tried putting the ssh command in quotes and putting it in a separate file accessed with the -m flag, but the batch file always opens a window that says "Warning: Permanently added '[server2]' <RSA> to the list of known hosts" and then hangs.

I'm completely and utterly baffled. Any ideas?

Erin
Adrian J Milanoski
2010-10-31 23:47:14 UTC
Permalink
Hey,

Yeah not sure if this is the write place but i've had similar issues
with plink. Try instead of using the -m flag to not use it but merely

plink ***@ip < cmds.txt


See if that works. Good luck!

Thanks,
Adrian
_________________
Sent from my iPhone
Post by l***@triad.rr.com
I'm not sure this is the right place for this, but there doesn't
seem to be a place to get help with Plink specifically.
I'm trying to write a batch file that will use Plink to tunnel to
Server 1 via ssh, then use Plink's remote command function to tunnel
I should mention that when I log into Server 1 through Plink and
then manually enter the ssh command, it works fine. I've tried
putting the ssh command in quotes and putting it in a separate file
accessed with the -m flag, but the batch file always opens a window
that says "Warning: Permanently added '[server2]' <RSA> to the list
of known hosts" and then hangs.
I'm completely and utterly baffled. Any ideas?
Erin
Saif El Sherei
2010-10-31 22:41:49 UTC
Permalink
Why dont u just ssh to server 1 then reverse tunnel server 2 through server 1 to ur machine using plink -R switch

i can see you open a dynamic tunnel from server 1 to ur machine then u want to run ssh command from this tunnel btw you're missing '-s' switch before the remote command you want to run

But i dont really get the script it works from lets say machine A to connect remotley to machine B then tunnel to machine C??

Also i think that you'll have to cache the keys manually for the script to work because on first connection plink will ask if you want to add ssh key to cache, And you have to manually reply

Hope this helped

Regards,

Saif El-Sherei
OSCP


Sent from my iPhone
Post by l***@triad.rr.com
I'm not sure this is the right place for this, but there doesn't seem to be a place to get help with Plink specifically.
I should mention that when I log into Server 1 through Plink and then manually enter the ssh command, it works fine. I've tried putting the ssh command in quotes and putting it in a separate file accessed with the -m flag, but the batch file always opens a window that says "Warning: Permanently added '[server2]' <RSA> to the list of known hosts" and then hangs.
I'm completely and utterly baffled. Any ideas?
Erin
Loading...