Topic "Trouble with hostkey auto-confirmation"

Author Message
moshe.h
[View user's profile]

Joined: 2010-12-21
Posts: 2
I am running winscp.com from a .net2.0/C# System.Diagnostics.Process object.
I am using a privatekey file.

The following is a the argument string used when calling winSCP.com:
blah@blahblah.com
/privatekey="C:\tmp\blah.ppk"
/hostkey="ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
/command
"option confirm off"
"cd ""/home/blah/moshe_temp/"""
"put ""c:\Dev\DotNet\Application\WinSCP.ini"""
"put ""c:\Dev\DotNet\Application\WinSCP.com"""
"put ""c:\tmp\stam.txt"""
"exit"


NOTE: I USED THE ABOVE STRING IN CMD AND IT WORKED JUST FINE.

In my c# program the process hanged - waiting for a hostkey confirmation. The hostkeys were identical. I killed the winscp.com process and looked at the output string:
Searching for host...
Connecting to host...
Authenticating...
The server's host key was not found in the cache. You have no guarantee that the server is the computer you think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
If you trust this host, press Yes. To connect without adding host key to the cache, press No. To abandon the connection press Cancel.
Continue connecting and add host key to the cache?
(Y)es, (N)o, C(a)ncel, (C)opy Key:


Please advise

Thank you
Moshe

PS
How do you chain multiple options?
option batch on
option confirm off


I did not find anything in the docs
Advertisements
Guest




moshe.h wrote:
The hostkeys were identical.

...or not...I'm not prikryl, so I could be wrong, but I noticed this...

moshe.h wrote:
/hostkey="ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"

moshe.h wrote:
ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx

...as far as I know host keys will not match if the bits are different, you specify 1024 bits & receive 2048 bits.

I also have no idea why it works in CMD & doesn't work the other way. Can you find out how many bits you are getting & is working in CMD? Does the server support both 1024 & 2048 bits?
moshe.h
[View user's profile]

Joined: 2010-12-21
Posts: 2
Anonymous wrote:
moshe.h wrote:
The hostkeys were identical.

...or not...I'm not prikryl, so I could be wrong, but I noticed this...

moshe.h wrote:
/hostkey="ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"

moshe.h wrote:
ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx

...as far as I know host keys will not match if the bits are different, you specify 1024 bits & receive 2048 bits.

I also have no idea why it works in CMD & doesn't work the other way. Can you find out how many bits you are getting & is working in CMD? Does the server support both 1024 & 2048 bits?


GOOD EYE guest, I missed the difference.
BTW - running from the CMD worked because I have a few copies of WinSCP.com floating around and I used a different one Embarassed

QUESTION: is there a way to know a-priori if an ftp server is ssh-rsa 1024 or ssh-rsa 2048?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
Sure, you can know it. The same way you've learnt the rest of the host key.
_________________
Martin Prikryl
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