sshnet / SSH.NET

SSH.NET is a Secure Shell (SSH) library for .NET, optimized for parallelism.
MIT License
3.87k stars 915 forks source link

Multifactor SSH Client #1390

Closed abeeme closed 1 month ago

abeeme commented 1 month ago

Hi,

I want to open a SSH client connection using two authentication methods: password and private key.

I've been testing SSH client connections with these two methods and it seems if the first one connects to the system correctly, the second one is not used. Is always this way or does the library let you use two methods somehow? I mean, what if I need to use two authentication methods and I only want to open the connection in case both work?

Thank you in advance

Rob-Hague commented 1 month ago

That is a server-side configuration. You can't stop the server from authenticating you if it considers one method to be sufficient.

If you want to verify the identity of the server, you can check against its fingerprint following the example at https://github.com/sshnet/SSH.NET#verify-host-identify

abeeme commented 1 month ago

Thank you for your quick response.

As this is a server-configuration, I understand if the server is configured to allow client connections via password and private key, using an instance of SshClient with these two auth methods will work as expected: only connection will be opened if both methods work, right?

Rob-Hague commented 1 month ago

Correct

abeeme commented 1 month ago

Okey, thank you so much!