Trouble with hostkey auto-confirmation

Advertisement

moshe.h
Joined:
Posts:
2

Trouble with hostkey auto-confirmation

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

Reply with quote

Advertisement

Guest

Re: Trouble with hostkey auto-confirmation

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?

Reply with quote

moshe.h
Joined:
Posts:
2

Re: Trouble with hostkey auto-confirmation

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 :oops:

QUESTION: is there a way to know a-priori if an ftp server is ssh-rsa 1024 or ssh-rsa 2048?

Reply with quote

Advertisement

You can post new topics in this forum