1

I'm migrating a WordPress site to Google Cloud using Click To Deploy. All as gone well so far except a folder permissions problem when migrated the current sites wp-content folder.

Steps I took to make this work...

  1. I set up a new WordPress install by using Click To Deploy and tested that I could upload new images to the server.
  2. Uploaded and installed my backup database and current site files. In other words, I overwrote the files on the new WordPress install.
  3. Tested the site by changing my 'host' file to match the new Google Cloud IP.

All looks great on the front end but in the admin area I can no longer upload images for new posts or pages.

I know this is probably a permission issue but I can't figure it out. Please let me know if you have suggestions.

  • I tried using the following command which is supposed to change the ownership but it's not supported in Google Cloud chown -R user:owner /folder – Darren Jackson May 29 '15 at 02:54
  • Do you have the same issue as in [this question](http://stackoverflow.com/q/27807018/3618671)? If so, see my answer. If not, please clarify what you mean: what the error is, where do you see it, screenshots or terminal output, if possible, would be ideal. – Misha Brukman May 30 '15 at 00:18
  • I don't think so. I haven't had any issues getting files uploaded to the cloud. That part is somewhat easy and straight forward. The issue I ran into is when I used Google's Click to Deploy for Wordpress. I deployed the site and logged in to test it... Everything worked great. I could upload files with no issue. I then overwrote the wp-content files to migrate my site over to Google Cloud. Doing this changed the ownership of the files. The site itself looks good but I can't upload new images and email no longer works. – Darren Jackson May 31 '15 at 19:21
  • Did you run the `chown` command without `sudo`? You need to use `sudo` on the VM. – Misha Brukman May 31 '15 at 20:32

1 Answers1

1

If you have a good sense that it's directory permission issues, a simple way to diagnose might be to create a new Google Cloud Project, create another click to deploy instance, ssh to /var/www and run ls -al and compare permissions between what you have today and what the default scheme is. You may have to descend down a few levels into the directory that holds user-uploaded files.

My guess is that when you copied your site onto your instance, you modified directories where your linux user account is the owner, and when you try to upload files, the www-data user (Apache) cannot write to those directories any more.

You shouldn't have any issues running chown when logged in via ssh. Please post the output or error messages of that command.

chrispomeroy
  • 800
  • 5
  • 6
  • 3
    the exact command you should run is sudo chown -RL www-data:www-data /var/www This will ensure that the /var/www/wp-content/uploads directory is owned by www-data and in group www-data – chrispomeroy May 30 '15 at 01:02
  • Thanks for the help Chris but I found where the chown command isn't supported in Google Cloud. Reference: https://cloud.google.com/appengine/docs/php/googlestorage/advanced – Darren Jackson May 31 '15 at 19:15
  • @DarrenJackson, what you're referring to is documentation for the PHP API to access Google Cloud Storage, which is not what you're using: you're using the VM's own disk, which is like a hard disk in your computer. @chrispomeroy is asking you to run the command on the VM itself. Don't forget the `sudo` in front of `chown`, that's very important. – Misha Brukman May 31 '15 at 20:33
  • I'll give that a try and report back. Thanks! – Darren Jackson Jun 02 '15 at 01:17
  • Turns out that all I had to do was add sudo to the beginning of my statement and all works well. Thanks for your help! – Darren Jackson Jun 02 '15 at 03:16
  • I have the same issue, if i assign `sudo chown -RL www-data:www-data /var/www` i can no longer upload from sftp and when i assign `sudo chown -RL myuser:www-data /var/www` i can upload but then i can't download a plugin it ask for ftp credentials and as i am using sftp so no option for .ppl file. Really stucked. So i have to back and forth the command. – khan Jul 19 '17 at 18:16