Skip to content

Authentication exception when connecting to Fedora using private keys #834

@david-haim-sentinelone

Description

@david-haim-sentinelone

Hi there
In my company we're using this library for our SSH communication with C#.
We found out that when trying to connect to fedora using private keys, a Renci.SshNet.Common.SshAuthenticationException is thrown.

To reproduce: set up a fedora machine with SSH enabled with a private key, for example, by following the tutorial here, make sure that everything was set up correctly by connecting using your terminal/power shell.

using this example code :

var key = "private key goes here";
var ms = new MemoryStream(Encoding.UTF8.GetBytes(key));

var connectionInfo = new ConnectionInfo(
	"ip goes here",
	"username goes here",
	new PrivateKeyAuthenticationMethod("username goes here", new PrivateKeyFile(ms)));
	
var sshClient = new SshClient(connectionInfo);
sshClient.Connect();

A Renci.SshNet.Common.SshAuthenticationException: Permission denied (publickey) exception is thrown.
From our small research, this doesn't happen with other unix-os (like ubuntu and cent-os) and doesn't happen when using a standalone implementation. like open-ssh. It happens only when the remote os is fedora and when trying to connect with a private key. Trying to connect to Fedora with a password also seem to work fine.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions