SFTP upload file Permission denied

You seemed to upload your local file “C:\Workspace\upload-file\test.xlsx” to remote directory, “/var/www/folder” on SFTP.

I guess you have all permissions for reading,writing,executing etc on your local file(“C:\Workspace\upload-file\test.xlsx”), but your remote folder, “/var/www/folder”, might not accept your application’s access including “upload” action.

SOLUTION:

The most simplest way to solve this issue is just granting all permission for all users to do anything in your upload target directory(“/var/www/folder”). Please try this linux commands for checking permission on your upload folder.

ls -ld /var/www/folder

If you see your /var/www/folder/ directory is not allowed writing or reading(ex:drwxr-xr-x) for normal users, please grant permissions for this folder with the follwing command.

chmod 777 /var/www/folder
//check permission again.
ls -ld /var/www/folder

If you can check the target folder’s permission is enough(drwxrwxrwx), please run your application again.

NOTE: Giving all permissions for other users is not considered a good practice. Please just do this solution for test, and change the permission setting fit to your specification later. For more detail, Please check this link(Click).

Leave a Comment