How to call WinSCP without hostkey

Advertisement

JonWayn70
Donor
Joined:
Posts:
9
Location:
Bellingham, WA

How to call WinSCP without hostkey

I had to automate a download process so I started by creating a WinSCP connection, then copying the generated string so I can obtain the string for the automation. It worked all well on my test computer but when I tried doing the very same thing on the computer where it will reside, something different happened. The generated string was very basic. It had only the sftp url, and login name, no password or hostkey. But the script file i created doesnt work. I deleted and recreated the connection in WinSCP but it was created the same way again. How can I force it to create a full string code?

The installations behave differently on the 2 computers. On the first, when I click on Session/Generate Code, a tabbed dialog appears where I can select Url, Script, or .net assembly code. But on the other, there is just one untabbed window with checkboxes. When I check hostkey, it inserts fingerprint and adds an unusual looking code. Why are these machines different? the versions are 5.19.* and 5.7.*

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
37,591
Location:
Prague, Czechia

Re: How to call WinSCP without hostkey

What is "string for the automation"? Do you mean session URL?

The host key is not part of your session settings. It's cached on the first connection. So if you did not connect yet on the other machine, WinSCP does not know the host key and cannot include it in the generated URL/script/code/whatever.
As documented: https://winscp.net/eng/docs/ui_generateurl

WinSCP 5.7.* is over 7 years old. So no wonder it is different to the latest 5.19.*. Do not use it.

I'm not sure, where are you heading with your question title. You do not want to "call WinSCP without host key". The hostkey should be included in your script. See:
https://winscp.net/eng/docs/scripting#hostkey
https://winscp.net/eng/docs/faq_hostkey

I'm not even sure, what you ask for. You seem to have valid URL (or whatever) from your first machine. Just use that.

If you want help with your script, we need to see it. And any error you are getting. Even better a session log file.

Reply with quote

JonWayn70
Donor
Joined:
Posts:
9
Location:
Bellingham, WA

Re: How to call WinSCP without hostkey

martin wrote:

What is "string for the automation"? Do you mean session URL?
Maybe I just need to update the installation to the latest. However the 2 session strings look like this:
sftp://PowerInDataInc:Pid18510%40@somesite.org/ -hostkey="ssh-rsa 2048 S5bUPHeeeFw/o8+D+UoZAOV069C2L5BiIlKeXpzlCzg="
and
sftp://PowerInDataInc:Pid18510%40@somesite.org/
The second one fails. But, I will update the software and see what that does. I think i generated the code right after I created the connection but before I first opened it. However even after I opened it, the generated code remained the same. Thanks for the reply

Reply with quote

JonWayn70
Donor

Re: How to call WinSCP without hostkey

I have updated the software and the generated code now looks full, except that instead of hostkey=..., it has fingerprint=.... Out of curiosity, is there any functional difference? I am happy to report that my script now works. Thanks again.

Reply with quote

martin
Site Admin
martin avatar

Re: How to call WinSCP without hostkey

You are looking on different tabs. URL tab has fingerprint=... URL parameter, while Script tab has -hostkey=... switch of the open command.

Reply with quote

Advertisement

You can post new topics in this forum