Discuss (FTP), (FTP on .NET CF) and (FTPS, SFTP and SCP).
no avatar
User

Mshelnutt

Posts

7

Joined

Sat Aug 25, 2012 4:35 am

SFTP.KnownHosts.AddKnownHost(x,y) returning nothing?

by Mshelnutt » Sat Aug 25, 2012 4:54 am

no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

Re: SFTP.KnownHosts.AddKnownHost(x,y) returning nothing?

by support2 » Sat Aug 25, 2012 7:30 am

no avatar
User

Mshelnutt

Posts

7

Joined

Sat Aug 25, 2012 4:35 am

by Mshelnutt » Sat Aug 25, 2012 7:32 am

ok, will do -

Let me ask this - what other items should I set

ServerValidation needs to be Automatic or AutomaticNoName

I am assuming I need to set the UserName, but not Password - correcT?

=====

My Logging shows:
DEBUG [SSHFTPClient] 24 Aug 2012 14:41:57.738 : HostKeyChecker checking for ssh-rsa public key of 'abccompany.com'

ERROR [SSHFTPClient] 24 Aug 2012 14:41:57.739 : Stored public key for host 'abccompany.com' does not match supplied key

DEBUG [ClientKeyExchanger] 24 Aug 2012 14:41:57.739 : Processed SSH_MSG_KEXDH_INIT reply - failed to verify hostkey

ERROR [SSHFTPClient] 24 Aug 2012 14:41:57.799 : Failed to connect - closing connection

ERROR [SSHFTPClient] 24 Aug 2012 14:41:57.799 : EnterpriseDT.Net.Ftp.Ssh.SFTPAuthenticationException: Authentication failure

ERROR [SSHFTPClient] 24 Aug 2012 14:41:57.799 : at EnterpriseDT.Net.Ftp.Ssh.SSHFTPClient.Connect()

what happens if the customers supplied key is from their host name which is something like 'abccompany.interna.com' but the host I connect to is 'abccompany.com' - could that be the issue.


I have tried to use the CALLBACK feature - and I dont get the authentication error -
What happens there is when it goes to Connect() - it sits there - in that method and never returns.

I see in the log a lot of these repeated steps:

DEBUG [PlainSocket] 24 Aug 2012 16:04:23.846 : RepeatCallback received 68 bytes

DEBUG [SSH2Connection] 24 Aug 2012 16:04:23.846 : Packet arrived

DEBUG [SSH2Connection] 24 Aug 2012 16:04:23.847 : ProcessAuthenticationResponse: SSH_MSG_USERAUTH_INFO_REQUEST

DEBUG [SSH2Connection] 24 Aug 2012 16:04:23.847 : Prompt count = 1

DEBUG [SSH2Connection] 24 Aug 2012 16:04:23.847 : Prompt: Enter password:

DEBUG [SSH2Connection] 24 Aug 2012 16:04:23.847 : Sent SSH_MSG_USERAUTH_INFO_RESPONSE

DEBUG [SSH2Connection] 24 Aug 2012 16:04:23.847 : Waiting for packet

DEBUG [PlainSocket] 24 Aug 2012 16:04:23.941 : RepeatCallback received 76 bytes

DEBUG [SSH2Connection] 24 Aug 2012 16:04:23.941 : Packet arrived

DEBUG [SSH2Connection] 24 Aug 2012 16:04:23.941 : ProcessAuthenticationResponse: SSH_MSG_USERAUTH_FAILURE

DEBUG [SSH2Connection] 24 Aug 2012 16:04:23.941 : Auth partial success. Try: password,publickey,keyboard-interactive

DEBUG [SSH2Connection] 24 Aug 2012 16:04:23.941 : Waiting for packet
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

by support2 » Sat Aug 25, 2012 10:09 am

ServerValidation should be Automatic.

The message "Auth partial success" means that public key authentication partly succeeded - it may mean that the server also requires a password for this user. So try setting the password as well. You might need to set the authentication method to PublicKeyAndPassword.

If you aren't sure of the hostname, add it for both, e.g.

AddKnownHost("abccompany.interna.com","mylocalpubfile")
AddKnownHost("abccompany.com","mylocalpubfile")
no avatar
User

Mshelnutt

Posts

7

Joined

Sat Aug 25, 2012 4:35 am

by Mshelnutt » Sun Aug 26, 2012 2:31 am

Thanks for the Reply

If I set the AuthenticationMethod to

I get this error
ClientPrivateKeyFile property must be set to the full path of the private key (or ClientPrivateKeyBytes must be set).

which i found odd because I am not using a Client Private Key.

I have gotten the CALLBACK method to work If I supply both the UserName and Password
Also , if I generate a known_host file from the callback (as was in one of your examples) and then use that file by setting the .KnownHosts.KnownHostsFile (again with username/password) it works

but calling the .KnownHosts.AddKnownHost("fooo.com","myfile") doesn't

I noticed the known_host file that gets produced from the call back is not in the same format as the examples you show. It has
hostname ssh-rsa XXXXXXX
there is no ip address.


I dont mind using the callback method and will find out why a password is required.

Thanks for your help
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

by support2 » Sun Aug 26, 2012 7:34 am

You have to use either a password (for password authentication) or a private key (for public key authentication). First thing to do would be to use the default (password authentication) and set the password.
no avatar
User

Mshelnutt

Posts

7

Joined

Sat Aug 25, 2012 4:35 am

by Mshelnutt » Tue Aug 28, 2012 3:43 am

no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

by support2 » Tue Aug 28, 2012 7:23 am

no avatar
User

Mshelnutt

Posts

7

Joined

Sat Aug 25, 2012 4:35 am

by Mshelnutt » Tue Aug 28, 2012 7:24 am

no avatar
User

Mshelnutt

Posts

7

Joined

Sat Aug 25, 2012 4:35 am

by Mshelnutt » Tue Aug 28, 2012 12:36 pm

no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

by support2 » Tue Aug 28, 2012 12:46 pm

no avatar
User

Mshelnutt

Posts

7

Joined

Sat Aug 25, 2012 4:35 am

by Mshelnutt » Tue Aug 28, 2012 12:47 pm


Who is online

Users browsing this forum: No registered users and 1 guest

Powered by phpBB ® | phpBB3 Style by KomiDesign
cron