0 votes
by (200 points)

I have been trying to transfer files through Rebex SFTP.
The connection of the SFTP is successful, but on execution of putfile command or GetList command, the following log is written :
"Not authenticated to the server."

What could be that I am missing.?

Applies to: Rebex SFTP
by (200 points)
I have been connect to the Server using CuteFTP,  with the same credentials along with the pfx  file (as private key) and cer file (as public key).
but then the code doesnt allow me to execute the PuFile command, neither does it download by GetFile command..

1 Answer

+1 vote
by (147k points)
selected by
 
Best answer

Please make sure you call both the Connect and Login methods before calling PutFile/GetFile, and that the Login method actually succeeds. If you don't find any problem, create a communication log using Sftp object's LogWriter property and either post it here or mail it to support@rebex.net. Based on the log, we should be able to tell what is going on.

by (200 points)
Hi Lukas,
As you said I checked the code, and yes the Login method was commented..
I uncommented it, and only two parameters were being passed, i.e, 'username and password'.

And on running the service, following log was written :
"Authentication was partially successful, but server requires additional authentication with: 'publickey'."

The Login constructor accepts a third parameter also, which is but a SshPrivatekey type.

Any suggestions.?
by (147k points)
a) If you are trying to authenticate using a certificate, try this:
    https://www.rebex.net/sftp.net/features/authentication.aspx#x509-certificate

b) If you are trying to authenticate using a public key with a private key stored in a PFX file, initialize the SshPrivateKey this way instead:
    https://www.rebex.net/sftp.net/features/private-keys.aspx#asymmetric-algorithm-keys

Additionally, if you need to use password as well, use the Login method that accepts both password and private key.
by (200 points)
I have tried authenticating using both the methods..

But the SshPrivateKey object is expecting more than one arguments..
by (147k points)
SshPrivateKey has 5 constructors and two of them expect one argument: https://www.rebex.net/doc/api/Rebex.Net.SshPrivateKey.-ctor.html
(Unless you use a very outdated version of Rebex SFTP)
...