I have an EC2 instance and in it I use WordPress. To edit WordPress plugins and themes files I use WinSCP.

The problem is that if I try to edit a file via WinSCP I get the following error message:

Upload of file 'index.php' was successful, but error occurred while setting the permissions and/or timestamp.

If the problem persists, turn off setting permissions or preserving timestamp. Alternatively you can turn on 'Ignore permission errors' option.

Permission denied . Error code: 3
Error message from server: Permission denied

Permission denied

I know it happens because I'm logged in with the ec2-user user.

And the folder permissions to WordPress work perfectly are:

drwxrwsr-x 2 apache www 4096

Since I can not simply change the owner of the /var/www as would cause the lost WordPress write permissions, how can I solve this?


The solution is in the error message.

Turn off setting permissions or preserving timestamp.

On *nix systems, you cannot change file permissions and timestamp, if you are not the owner of the file, no matter that you have write permissions to the file.

Setting permissions is turned off by default in WinSCP, so you probably need to turn off preserving of the timestamp only.

Go to Preferences and select the Transfer page. Select the Default preset and click the Edit.

enter image description here

On the Transfer Settings dialog uncheck the Preserve timestamp and make sure the Set permissions is unchecked.

enter image description here

Had you clicked the Help button on the error message, you would get the same advice:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.