I know that private key authentication works, however I'm looking for public key authentication.
I'm trying to establish a connection using SSH.NET and a public key.
In the Git Bash terminal I can connect and run commands fine using my public key, but when I try connecting to the same host using SSH.NET I get an exception.
Here is my how I'm trying to connect:
using (var client = new SshClient("host.name.com", port, "username"))
{
client.Connect(); // exception thrown here
}
I've also tried this route:
var authMethod = new PrivateKeyAuthenticationMethod("username");
var info = new ConnectionInfo("host.name.com", port, "username", authMethod);
using (var client = new SshClient(info))
Both give the same exception: Permission denied (publickey).
It seems as though I need to specify where my public key is, or I need to put my public key in a certain spot, but I can't find any documentation telling me where to put it.