'Renci.SshNet.Common.SftpPermissionDeniedException: 'Permission denied'
I am new to SFTP.
I am getting Renci.SshNet.Common.SftpPermissionDeniedException: 'Permission denied' error while uploading an image to the SFTP location from asp.net core.
I have installed the WinSCP tool, and there I can see that particular SFTP folder doesn't have "write" permission. and I don't have the right to change the permission.
below is my code
public void UploadFileToSFTP(IFormFile requestFile)
{
using (var sftp = new SftpClient(host, username, password))
{
sftp.Connect();
if (sftp.IsConnected)
{
using (var uplfileStream = requestFile.OpenReadStream())
{
sftp.UploadFile(uplfileStream, "/folderpath/" + requestFile.fileName, null);
}
}
sftp.Disconnect();
}
}
am I doing anything wrong in the code?
or just adding write permission to the folder will work here.
Thanks in advance!
Solution 1:[1]
I am able to upload images to the SFTP server after getting "write" permission for the SFTP folder.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Explorer |
