I setup WordPress on an Amazon EC2 instance. It’s using Amazon Linux and is a standard setup (just php5 and mysql).
WordPress works fine, but there’s some permission issues. Specifically I can’t upload media, update permalink, plugins, etc. I have no write permission under the ec2-user and because I uploaded all the files over WinSCP the current owner is ec2-user.
My question is what’s the best way to correct this issue? I could probably fix it by changing ownership of all folders/files to root, but that’s not a very elegant or dynamic solution.
The path to my web directory is /var/www/html. Can I allow the ec2-user the correct permissions? Perhaps by having a group that both the Apache user and ec2-user share?
Any ideas would be appreciated
See http://blog.david-jensen.com/development/wordpress-amazon-ec2-apache-permissions-wordpress/ among other Google results. He looks to have had good luck:
From the webpage:
Run
I then set permissions to what the hardening WordPress guide recommends for my html root as all my WordPress files are there as I am running MultiSite with multiple domains.
As apache doesnât have a login I feel this is worth the risk though there is probably a better way to do this. I then added ec2-user to the apache group and changed the permissions of the wp-content folder to have group write permission 775.
This allows FileZilla or any other program logged in as ec2-user the ability to change files and folders in the wp-content folder only. If anyone has a better way of doing this I would like to know. I am only using SSH and SFTP to access the server with key files.
I set the owner to ec2-user:apache, then perform the hardening, then adjust the group read+write permissions for the folders.
Then edit /wordpress-install/wp-config.php and define the fs_method
Now wordpress can update/upload, etc. And you can still SFTP files without changing the permissions every time.
I tried the solution provided in the answer by @markratledge for my AWS EC2 instance (Amazon Linux).
WordPress(apache) was good, but SFTP(ec2-user) was giving permission errors.
Then I tried the following:
I added ec2-user to the apache group:
Next I set ‘apache’ as owner group and ‘ec2-user’ as owner user for the WordPress installation directory (/var/www/html in my case):
Finally, WordPress was happy and I could SFTP too. Thanks!
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hosting-wordpress.html
I came across this question searching for the answer. I set all ownership and group ownership to Apache. However, if I want to upload something ftp I have to ssh change permissions to ec2-user upload the file and change it back. I figured it was a small price to pay to have the permissions set to WordPress’s recommended settings.