0

I recently had a PHP syntax error that crashed my server after using the plugin editor on my Wordpress website. It is an AWS Elastic Beanstalk hosted website, so I had to use PuTTY to change the file permissions and allow ec2-user to read/write durring SFTP via Filezilla.

I am not experienced with his sort of thing and followed the information from this question to accomplish this task.

Everything went well, but now I cannot edit or "write" anything via my Wordpress website. No plugin updating, no file editing, nothing. It says I need to change my permissions.

Due to my lack of knowledge on this, I have no idea how to reverse what I did when I entered

chown -R ec2-user /var/app
chmod -R 755 /var/app

How do I set the permissions back so I can edit files and update plugins via Wordpress admin?

EDIT: I found out that all I did was change ownership of the files to ec2-user. SO I guess my new question is how do I find out what username to use for my WordPress site to give it back ownership of the files?

Community
  • 1
  • 1
Seb G
  • 661
  • 1
  • 15
  • 34
  • You changed the owner to ec2-user, but Wordpress is running as a different user, and now it doesn't have permission to modify files. You need to change the files back to whatever user owned them before. – Mark B Sep 07 '17 at 15:39
  • @Mark thank you for explaining. Is there a default user for this typically, or a way to find out what the name of the user is? – Seb G Sep 07 '17 at 15:47
  • You should be able to use the `ps` command to see what user the Wordpress service is running as. – Mark B Sep 07 '17 at 16:05

1 Answers1

0

Fixed: I wound up adding

echo(exec("whoami"));die();

to the top of my WordPress index.php file to figure out the user. Make sure to remove it once you're done.

Lets say my username wound up being "foo".

After I had the username, I went back into PuTTY, and ran

sudo chown -R foo /var/app

and can now modify files through wordpress again.

Seb G
  • 661
  • 1
  • 15
  • 34