Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

AvinashDesai

That was cool .. I got that error because of the Path for key was wrong .. now fine ..

thanks for the help martin :) ..
Finally it started working ..
martin

So post a log file for that.
AvinashDesai

But with that key what u said I get below error

Connection has been unexpectedly closed. Server sent command exit status 0.
martin

Re: Host key does not match configured key


* 2015-05-29 14:50:00.293 Host key fingerprint is ssh-rsa 2048 d4:3f:c0:a4:e6:e2:7a:76:48:5a:3e:96:0d:56:c3:a9.
* 2015-05-29 14:50:00.293 (Exception) **Host key does not match configured key "ssh-rsa 1024 03:cc:d2:da:68:06:b7:29:01:fc:b9:1c:4f:c8:2e:ac"!**

You pass "ssh-rsa 1024 03:cc:d2:da:68:06:b7:29:01:fc:b9:1c:4f:c8:2e:ac" to SessionOptions.SshHostKeyFingerprint, but the key is "ssh-rsa 2048 d4:3f:c0:a4:e6:e2:7a:76:48:5a:3e:96:0d:56:c3:a9".
I believe it's pretty self-explanatory.
AvinashDesai

Any help .? even provided log ?
AvinashDesai

Any help ?? I am stuck at that place since 2-3 days .. No help from anywhere waiting only at this forum .
AvinashDesai

    . 2015-05-29 14:49:56.778 --------------------------------------------------------------------------
    . 2015-05-29 14:49:56.778 WinSCP Version 5.7.3 (Build 5438) (OS 6.1.7601 Service Pack 1 - Windows Server 2008 R2 Enterprise)
    . 2015-05-29 14:49:56.778 Configuration: nul
    . 2015-05-29 14:49:56.778 Log level: Normal
    . 2015-05-29 14:49:56.778 Local account: DOMAIN\USERID
    . 2015-05-29 14:49:56.778 Working directory: D:\ST\VP\TEST\Feeds Copy
    . 2015-05-29 14:49:56.778 Process ID: 3612
    . 2015-05-29 14:49:56.778 Command-line: "D:\ST\VP\TEST\Feeds Copy\winscp.exe" /xmllog="C:\Users\USERID\AppData\Local\Temp\2\wscp1084.03C47A4F.tmp" /xmlgroups /nointeractiveinput /dotnet=573 /ini=nul /log="D:\ST\VP\TEST\Feeds Copy\New Text Document (2).txt" /console /consoleinstance=_4228_32001227_787
    . 2015-05-29 14:49:56.778 Time zone: Current: GMT+5:30 (India Standard Time), No DST
    . 2015-05-29 14:49:56.778 Login time: Friday, May 29, 2015 2:49:56 PM
    . 2015-05-29 14:49:56.778 --------------------------------------------------------------------------
    . 2015-05-29 14:49:56.778 Script: Retrospectively logging previous script records:
    > 2015-05-29 14:49:56.778 Script: option batch on
    < 2015-05-29 14:49:56.778 Script: batch on
    < 2015-05-29 14:49:56.778 Script: reconnecttime 120
    > 2015-05-29 14:49:56.778 Script: option confirm off
    < 2015-05-29 14:49:56.778 Script: confirm off
    > 2015-05-29 14:49:56.778 Script: option reconnecttime 120
    < 2015-05-29 14:49:56.778 Script: reconnecttime 120
    > 2015-05-29 14:49:56.778 Script: open scp://tranVP@HOSTNAME.sd.com:22 -hostkey="ssh-rsa 1024 03:cc:d2:da:68:06:b7:29:01:fc:b9:1c:4f:c8:2e:ac" -timeout=15
    . 2015-05-29 14:49:56.778 --------------------------------------------------------------------------
    . 2015-05-29 14:49:56.778 Session name: tranVP@HOSTNAME.sd.com (Ad-Hoc site)
    . 2015-05-29 14:49:56.778 Host name: HOSTNAME.sd.com (Port: 22)
    . 2015-05-29 14:49:56.778 User name: tranVP (Password: No, Key file: No)
    . 2015-05-29 14:49:56.778 Tunnel: No
    . 2015-05-29 14:49:56.778 Transfer Protocol: SCP
    . 2015-05-29 14:49:56.778 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
    . 2015-05-29 14:49:56.778 Disable Nagle: No
    . 2015-05-29 14:49:56.778 Proxy: none
    . 2015-05-29 14:49:56.778 Send buffer: 262144
    . 2015-05-29 14:49:56.778 SSH protocol version: 2; Compression: No
    . 2015-05-29 14:49:56.778 Bypass authentication: No
    . 2015-05-29 14:49:56.778 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
    . 2015-05-29 14:49:56.778 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
    . 2015-05-29 14:49:56.778 KEX: dh-gex-sha1,dh-group14-sha1,dh-group1-sha1,rsa,WARN
    . 2015-05-29 14:49:56.778 SSH Bugs: A,A,A,A,A,A,A,A,A,A,A
    . 2015-05-29 14:49:56.778 Simple channel: Yes
    . 2015-05-29 14:49:56.778 Return code variable: Autodetect; Lookup user groups: A
    . 2015-05-29 14:49:56.778 Shell: default
    . 2015-05-29 14:49:56.778 EOL: 0, UTF: 2
    . 2015-05-29 14:49:56.778 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
    . 2015-05-29 14:49:56.778 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
    . 2015-05-29 14:49:56.778 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
    . 2015-05-29 14:49:56.778 Cache directory changes: Yes, Permanent: Yes
    . 2015-05-29 14:49:56.778 DST mode: 1;Timezone offset: 0h 0m
    . 2015-05-29 14:49:56.778 --------------------------------------------------------------------------
    . 2015-05-29 14:49:56.778 Looking up host "HOSTNAME.sd.com"
    . 2015-05-29 14:49:56.871 Connecting to 10.173.169.64 port 22
    . 2015-05-29 14:49:57.043 Server version: SSH-2.0-OpenSSH_6.0
    . 2015-05-29 14:49:57.043 Using SSH protocol version 2
    . 2015-05-29 14:49:57.043 We claim version: SSH-2.0-WinSCP_release_5.7.3
    . 2015-05-29 14:49:57.106 Doing Diffie-Hellman group exchange
    . 2015-05-29 14:49:57.324 Doing Diffie-Hellman key exchange with hash SHA-256
    . 2015-05-29 14:50:00.293 Verifying host key rsa2 0x10001,0xe131957ce0cd24d4 98763b2be6db6ef4 3fc35ae23d7f1793 19354cb3dccb1da0 0ef77788c72e4811 19ecfb8f48eb6892 8836ba25545364d2 902164977fd855c7 85e8c027bb0e6184 4fc8f7ecddffe331 be072ccbab45ef1b 7007792f3b0ff4ed 52c7f8a58c9815ec cdc8a724f9e8364a e11d0f29b37a8fb4 c72f6a0bbb129a19 ed718544cb7e003e 34ebbeaf20913e3d 66e3eb77b9ac6890 b0e467c5eb55e8d1 362a99786d638f67 67f4f5985803df71 6579131f58a58d0c bb587c7d860c4634 21c88534b5412174 3be47b47a83ba93c 0b49a90116230b5a ab0d0a8c07e91035 3db271170149b464 dbe0978af7fa912c 7f7d25406b1c4d13 9e7ef69e4cc592c9 with fingerprint ssh-rsa 2048 d4:3f:c0:a4:e6:e2:7a:76:48:5a:3e:96:0d:56:c3:a9
    . 2015-05-29 14:50:00.293 Host key does not match configured key ssh-rsa 1024 03:cc:d2:da:68:06:b7:29:01:fc:b9:1c:4f:c8:2e:ac
    . 2015-05-29 14:50:00.293 Attempt to close connection due to fatal exception:
    * 2015-05-29 14:50:00.293 Host key fingerprint is ssh-rsa 2048 d4:3f:c0:a4:e6:e2:7a:76:48:5a:3e:96:0d:56:c3:a9.
    * 2015-05-29 14:50:00.293 (Exception) **Host key does not match configured key "ssh-rsa 1024 03:cc:d2:da:68:06:b7:29:01:fc:b9:1c:4f:c8:2e:ac"!**
    . 2015-05-29 14:50:00.293 Closing connection.
    . 2015-05-29 14:50:00.293 Sending special code: 12
AvinashDesai

Re: Host key does not match configured key

martin wrote:

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.


I will be sending the LOG in the next post as I cant attach any documents
martin

Re: Host key does not match configured key

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.
AvinashDesai

But the same key works when connected via winscp exe
AvinashDesai

Host key does not match configured key

Hello

I am totally new to this winscp and I have pull the files from the unix box using winscp
I have got below url to refer and code.

https://winscp.net/eng/docs/library_session_listdirectory#example

I have coded accordingly below is my code

 Try


            ' Setup session options
            Dim mySessionOptions As New SessionOptions
            With mySessionOptions
                .Protocol = Protocol.Sftp
                .HostName = TxtHost.Text
                .UserName = TxtUName.Text
                .Password = TxtPwd.Text
                .PortNumber = 22
                .SshHostKeyFingerprint = TxtKey.Text
            End With

            LblInfo.Text = LblInfo.Text & "Assigned Session Options" & vbNewLine

            Dim mySession As New Session
            Using mySession
                LblInfo.Text = LblInfo.Text & "Session declared " & vbNewLine

                mySession.Open(mySessionOptions)

                LblInfo.Text = LblInfo.Text & "Connected" & vbNewLine

                Dim directory As RemoteDirectoryInfo = mySession.ListDirectory(TxtSource.Text)
                LblInfo.Text = LblInfo.Text & "Setting Transfer Options " & vbNewLine
                Dim fileInfo As RemoteFileInfo
                LblInfo.Text = "-----------------------------------------------------"

                For Each fileInfo In directory.Files
                    'Console.WriteLine("{0} with size {1}, permissions {2} and last modification at {3}", _
                    'fileInfo.Name, fileInfo.Length, fileInfo.FilePermissions, fileInfo.LastWriteTime)

                    LblInfo.Text = LblInfo.Text & fileInfo.Name.ToString & " with size " & fileInfo.Length.ToString & ", permissions " & fileInfo.FilePermissions.ToString & " and last modification at " & fileInfo.LastWriteTime.ToString & vbNewLine

                    'lblinfo.Text = "copied file : " & vbNewLine
                Next
                LblInfo.Text = "-----------------------------------------------------"

            End Using



My SshHostKeyFingerprint is like below format

ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx


but when I try to open session I get below error

Host key does not match configured key "
ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"!


Where am I going wrong and someone help me getting it corrected asap