0 votes
by (190 points)

Hello, I have problem to connect to sftp server.
My client give me such
sftp details:
- site
- port
- username
- PPK key

Info: using lib Rebex.sftp 3.0.5584.0 in c# project

Question
Am i able to connect without password ?
var PrivateKey = new SshPrivateKey(privateKey, password);

TEsting in WinSCP = connection ok.
Thank you
Marian

Applies to: Rebex SFTP

1 Answer

+1 vote
by (73.5k points)

Yes, you can authenticate using username and PPK only (without password). You only need to know passphrase for the PPK (if it has any, or use string.Empty if the PPK is not password protected).

Please see the example at Public/private key authentication.

by (190 points)
thank for  response,
using code :
PrivateKey = new SshPrivateKey(privateKey, string.Empty);
resulted in error :
System.ArgumentNullException: 'String reference not set to an instance of a String.
Parameter name: s'
by (73.5k points)
It seems your version of Rebex.Sftp 3.0.5584.0 is very old (released on 2015-04-15) and it was not able to handle empty PPK password.

The suggested solution is to upgrade to the latest version of Rebex libraries.

If you cannot upgrade for any reason, the possible workaround is to resave your PPK with a non-empty password and use that password in the code.
by (190 points)
Thank you, this workaround with generated password works fine. We will upgrade our Rebex license ASAP.
...