Connection OPEN works in GUI, not on console/script

Advertisement

IronPhoenix
Joined:
Posts:
5
Location:
USA

Connection OPEN works in GUI, not on console/script

Windows 10/1909. WinSCP ver 5.13.7
I have a server that I connect to via a tunnel regularly. Here is the open command as generated inside WinSCP for scripting:
open sftp://lewiske:zxcv%2F456@10.128.90.20:3389/ -rawsettings Tunnel=1 TunnelHostName="172.26.170.21" TunnelUserName="kris.ctr.lewis" TunnelPasswordPlain="A10THlt-!)"
(passwords altered from reality, but format left intact)
Using commander GUI, connection opens and works properly, no issues.
When I attempt to use that open command in /console, I get this:
Opening tunnel...
Searching for host...
Connecting to host...
Authenticating...
Expected host key was not configured, use -hostkey switch.
Host key fingerprint is ecdsa-sha2-nistp256 256 KmlymX4521gtpAaOhSrz4UY9CAEO+JNiAFTCQ/XqbUN=.
Authentication failed.
(fingerprint slightly altered)
when I alter the open command to include the hostkey as instructed, using this open line:
open sftp://lewiske:xxx@10.128.90.20:3389/ -hostkey="ecdsa-sha2-nistp256 256 KmlymX4521gtpAaOhSrz4UY9CAEO+JNiAFTCQ/XqbUN=" Tunnel=1 TunnelHostName="172.26.170.21" TunnelUserName="kris.ctr.lewis" TunnelPasswordPlain="xxx"
I get this:
Too many parameters for command 'open'.
Help?
Log attached (with some added data) though it does not seem useful. It gave no indication why the script failed - I found out in /console

(this server, the reasons for my connecting to it, and the data to be transferred are all Safety-of-Flight. I'm an Air Traffic Systems Field Engineer, the system is FAA). I can do what I need to do in GUI, but running scripts on the remote host in GUI mode is annoying - I shift to Mobaterm for that. I'd rather script the whole process.)

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,034
Location:
Prague, Czechia

Re: Connection OPEN works in GUI, not on console/script

Your updated open command is missing the -rawsettings switch:
open sftp://.../ -hostkey="..." -rawsettings Tunnel=...

Reply with quote

IronPhoenix
Joined:
Posts:
5
Location:
USA

It's missing that switch because I get the same "too many parameters" with it (thought maybe removal would reduce the param count enough).

Problem is no longer an issue. I moved the open statement out of the script. it's now part of the DOS Batch line that starts the process - WinSCP.exe "servername" /log=log /script=script
and the script starts with the first non-"open" command

Reply with quote

martin
Site Admin
martin avatar

IronPhoenix wrote:

It's missing that switch because I get the same "too many parameters" with it (thought maybe removal would reduce the param count enough).
I do not. Even with your old WinSCP 5.13.7, your command with -rawsettings added, works as expected.

Reply with quote

IronPhoenix
Joined:
Posts:
5
Location:
USA

Ah. Order matters.

winscp> open sftp://lewiske:abc@10.128.90.20:3389/ -rawsettings -hostkey="ecdsa-sha2-nistp256 256 KmlymX4521gtpAaOhSrz4UY9CAEO+JNiAFTCQ/XqbUN=" Tunnel=1 TunnelHostName="172.26.170.21" TunnelUserName="kris.ctr.lewis" TunnelPasswordPlain="xxx"
Too many parameters for command 'open'.
But re-arrange the order, and get...
winscp> open sftp://lewiske:abc@10.128.90.20:3389/ -hostkey="ecdsa-sha2-nistp256 256 KmlymX4521gtpAaOhSrz4UY9CAEO+JNiAFTCQ/XqbUN=" -rawsettings Tunnel=1 TunnelHostName="172.26.170.21" TunnelUserName="kris.ctr.lewis" TunnelPasswordPlain="xxx"
Opening tunnel...
Searching for host...
Connecting to host...
Authenticating...
Using username "kris.ctr.lewis".
Authenticating with pre-entered password.
Authenticated.
Connecting through tunnel...
Searching for host...
Connecting to host...
Authenticating...
Using username "lewiske".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Session started.
Active session: [1] lewiske@10.128.90.20
winscp>

Got it. I must have missed this in the docs... Oops.

Reply with quote

Advertisement

You can post new topics in this forum