Topic "Trouble passing HostKey in command line"

Author Message
[View user's profile]

Joined: 2008-12-18
Posts: 2
Location: PA
I am using WinSCP Version 4.1.8. I am trying to connect to an SFTP-2 server and have the host key automatically used. I would imagine that this would work quite easy if we were using a script file, but I am limited to just a command line call, not creating a extra file. Below is the command I am trying to run, but it seems to be an issue with the quotes around the open command and the hostkey.

winscp418.exe /console /command "open sftp://user:pass@server -hostkey="ssh-rsa 1024 5a:1e:d3:13:7c:1b:81e8:c2:09:7e:1e:34:a5:f1:5d"" "option continue on" "option confirm off" "option transfer binary" "put C:\somefile.ext /path/to/file/somefile.ext" "close" "exit"

I have tried the following methods:
hostkey=ssh-rsa 1024 5a:1e:d3:13:7c:1b:81e8:c2:09:7e:1e:34:a5:f1:5d
hostkey="ssh-rsa 1024 5a:1e:d3:13:7c:1b:81e8:c2:09:7e:1e:34:a5:f1:5d"
hostkey=\"ssh-rsa 1024 5a:1e:d3:13:7c:1b:81e8:c2:09:7e:1e:34:a5:f1:5d\"
hostkey=^"ssh-rsa 1024 5a:1e:d3:13:7c:1b:81e8:c2:09:7e:1e:34:a5:f1:5d^"
hostkey=""ssh-rsa 1024 5a:1e:d3:13:7c:1b:81e8:c2:09:7e:1e:34:a5:f1:5d""

Does anyone know of a way to get this working?
I am using Windows XP SP3.
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26911
Location: Prague, Czechia
Please read documentation. If that does not help, come back.

Alternative solution is to use /hostkey command line parameter to set the default hostkey.
Martin Prikryl
[View user's profile]

Joined: 2008-12-18
Posts: 2
Location: PA
Sorry should have turned on echo to see what was actually happening. I moved the option commands to the beginning of the list of commands and changed the incorrect "option continue on" to the correct "option batch continue".. All seems to be working now. Thanks for you time.

You can post new topics in this forum


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!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License