This project is read-only.

Ssh with Public Key

Mar 27, 2012 at 9:54 PM


We are given following info to connectt via Ssh:

HostName, Port, UserName and PublicKey - and everything works fine when using stand-alone Ssh client.

But I'm unable to connect to the same server using this library...

Is it possible to use PublicKey authentication method with this SSH.NET library ? If so, could you please provide a sample code?

Thank You,


Mar 29, 2012 at 1:40 PM



Sorry for late response.

Here is how I create ConnectionInfo object to connect using Private Key.

var connectionInfo = new PrivateKeyConnectionInfo("host", 22, "username", new PrivateKeyFile(File.OpenRead(@"Path to key file"), "passphrase"));

Hope it helps.