Topic "Command line use of HostKey"

Author Message
mrdobalina
[View user's profile]

Joined: 2010-01-25
Posts: 3
Location: USA
I am using winscp in an SSIS execute process task. The input into the executable is variable so I must execute command line. The process will be run from a system account so I need to pass the hostkey. When I run the script without the hostkey specified, under my account which has accepted the hostkey, it executes successfully. Could you please provide some guidance for my syntax?

Here is the command line:
winscp.exe /command "open ""sftp://uid:password@server:22"" -hostkey ""ssh-rsa 1024 00:00:00:00:00:00:00:00:00:00:aa:bb:cc:dd:ee:ff""" "option batch on" "option confirm off" "put ""c:\temp\source\testfile.txt""" "close" "exit"


After running the script I get following in console:
Too many parameters for command open.
batch on
confirm off
no session
no session


Using WinSCP 4.2.4 (Build 610) on Windows xp.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
I do not see anything wrong about your syntax. But I'm not sure if SSIS does parse/interpret the command line on its own somehow. Try to store your script into file instead. Let us know.
_________________
Martin Prikryl
mrdobalina
[View user's profile]

Joined: 2010-01-25
Posts: 3
Location: USA
I changed over to a script file with the same results.

My script file contains:
open sftp://testuid:password@server:22 -hostkey "ssh-rsa 1024 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00"
option batch on
option confirm off
put c:\temp\source\testfile.txt
close
exit

Results:
Too many parameters for command 'open'.
batch on
confirm off
No Session.
No Session.

Works like a charm without the hostkey switch.

One critical piece of information I missed due to sleep deprivation. I've moved development over to a 64 bit server so my environment is:
Windows Server 2003 R2
Standard x64 Edition
Service Pack 2
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
OK, now I have noticed the problem. You miss equal sign between -hostkey and the value:
-hostkey="ssh-rsa 1024 00:00:00:00:00:00:00...."
_________________
Martin Prikryl
Guest




Thank you for your quick responses. That fixes the issue when I use a script file. Unfortunately, my data will be variable so I must run this from command line instead of dropping script files. Is the syntax slightly different in command? I tried several combinations of quotes, dashes, and slashes.

The script that works successfully:
open sftp://testuid:password@server:22 -hostkey="ssh-rsa 1024 00:00:00:00:00:00:00..."
option batch on
option confirm off
put c:\temp\source\testfile.txt
close
exit

This is the command line that errors:
C:\Program Files (x86)\WinSCP>winscp.com /command "open ftp://testuid:password@server:22 -hostkey=""ssh-rsa 1024 00:00:00:...""" "option batch on" "option confirm off" "put ""c:\temp\source\testfile.txt""" "close" "exit"

Result of this command is:
Too many parameters for command 'open'.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
Your syntax works for me. Though it does not work with releases prior to 4.2.4 with the same error message you are getting. Are you sure you have 4.2.4? Both .com and .exe? Try to reinstall (and of course upgrade to stable 4.2.5).
_________________
Martin Prikryl
mrdobalina
[View user's profile]

Joined: 2010-01-25
Posts: 3
Location: USA
Upgrading from 4.2.4 to 4.2.5 did the trick. Thank you for the quick responses.
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License