Post a reply

Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)


Topic review


Re: Access denied when put files from fileshare

So if you create a plain WinSCP script with get \\\share\myfile.txt /uploads/folder/myfile.txt, would it fail the same way?

And if you call the script from a batch file, with copy \\\share\myfile.txt before running WinSCP, would copy work or not?

Access denied when put files from fileshare


I am using the WinScp lib and trying to transfer a file from a fileshare to a SFTP server:

session.PutFiles(@"\\\share\myfile.txt", "/uploads/folder/myfile.txt", false, transferOptions);

When using a fileshare \\\share I get the following:

WinSCP.SessionRemoteException: File or folder '\\\share\myfile.txt' does not exist.
System Error. Code: 5.
Access is denied
at WinSCP.OperationResultBase.Check()
at FileShareAccessTest.Program.Main(String[] args)

I have checked the user permissions for the fileshare and folder and it is full rights.
I can list files and folders on that file share with Directory.GetFiles().
It also works with another fileshares.

Could it be an firewall issue on the fileshare server \\
Do I need to open specific ports on the fileshare server for "session.PutFiles"?

Or what can I do to get more information?

Best regards,