Unable to upload a file SFTP using SSH.NET in C# – Permission Denied

You need to specify a full path to upload the file to.

For example:

client.UploadFile(fileStream, "/home/user/" + f.Name, null);

Without the path, the SFTP server probably tries to write the file to a root folder or other folder that you do not have a write access to (hence the Permission denied).

Leave a Comment