Sftp - Putfile permission denied

+1 vote
asked Feb 24, 2011 by Jonas Gulsrud (130 points)
edited Mar 25, 2011

Hi

I am trying to connect with sftp when I get this errormessage:

Rebex.Net.SftpException: Permission denied; syserr: Operation not permitted, file: . at wWGvS.APnbEo.sxMvMZ(BBdsJfZ , Type ) at wWGvS.APnbEo.Nbjil(String , AsNqWa , Boolean ) at Rebex.Net.Sftp.cqcMbi(AsNqWa , Object , String , Stream , Int64 , Int64 ) at Rebex.Net.Sftp.PutFile(Stream sourceStream, String remotePath)

The code:

Sftp sftp = new Sftp();
sftp.Connect(Hostname, Port);
sftp.Login(UserName, Password);

invoiceStream.Position = 0;
sftp.PutFile(invoiceStream, "/incoming/" + fileName);

It fails when I try to put the file.

I have used rebex to connect to several ftp servers before. This is the first time I see this, rather abstract, error message.

When I try to connect with a 3rd party client I have to accept an "unknown fingerprint".

Do you have any idea what might cause this?

Applies to: Rebex SFTP
commented Feb 24, 2011 by Lukas Pokorny (85,170 points)
This exception represents an error that was reported by the SFTP server. "Permission denied" is a status code and "syserr: Operation not permitted, file: " is the error message (both sent by the server). You are right that this is rather abstract - please create a log of communication using Sftp object's LogWriter property (see rebex.net/kb/logging.aspx for details) and either add it to your question or mail it to support@rebex.net - that should make it possible to see what is going on and hopefully be able to tell what to do about it.
commented Feb 28, 2011 by Jonas Gulsrud (130 points)
Investigating the log revealed an issue with the path used to upload the file. It seems that the server would not accept a leading "/" in the path. Removing it solved the issue. Thank you.

1 Answer

+1 vote
answered Mar 25, 2011 by Lukas Pokorny (85,170 points)
edited Mar 25, 2011

Check out the comment section of the question for an answer.

...