1

I am using Tamir.SharpSSH to make SFTP connections. I have servers' host, port, username, password and servers' fingerprint.

I am able to connect to the server without the fingerprint. Is there any way to match the fingerprint that I have with the servers' before making the connection?

Following is my C#.Net code for the connection:

 Sftp sftp = new Sftp(serverHost, userName, password);
 try
 {
      if (portNumber > 0) sftp.Connect(portNumber);                
      else sftp.Connect();
      sftp.Put(localFullFilePath, remoteFolder);                
 }

1 Answers1

0

Have you tried to use known_hosts file? I've solved the problem using the code below.

var jsch = new JSch();
var sr = new StreamReader(File.Open(@".\known_hosts", FileMode.Open));
jsch.setKnownHosts(sr);
var session = jsch.getSession("user_name", "host");
var sftp = session.openChannel("sftp") as ChannelSftp;
ocozalp
  • 68
  • 6