2

I am using wordpress with google cloud and set it up for sftp connection. The permission to folders are 755 and files are 644. Even i have changed Cloud API access scopes to "allow full connection".

When i try to add plugin through wordpress backend it will ask me for ftp credentials unless i change to sudo chown -Rf www-data.www-data /var/www/html but then i can't upload or change any file through sftp unless i change sudo chown -R [my-user-name]:www-data /var/www/html.

So i have to change permissions every time i change something either through sftp or through backend.

khan
  • 1,099
  • 1
  • 11
  • 21
  • I think the fastest way would be to use SFTP. First you need to generate a ssh key with puttygen. Then you need to save that key on your computer and also copy its content in the SSH keys of your GCE instance. Furthermore use any ftps client to connect to username@yourinstancepublicip – Roman Gherta Sep 20 '17 at 16:43

2 Answers2

20

I solved my problem like so.

First add your username(sftp username in mycase) in group www-data then assign group www-data as an owner and finally grant permission to www folder.

sudo adduser <username> www-data

sudo chown -R www-data:www-data /var/www

sudo chmod -R g+rwX /var/www

remember to restart filezilla or any sftp client you are using so the changes can take effect.

khan
  • 1,099
  • 1
  • 11
  • 21
0

I think this one might be considerd off-topic as this is a linux permissions issue and not a Google Cloud one, and it have been answered many times. Usually done by adding your linux user to the webserver group.

Whats the simplest way to edit and add files to “/var/www”

www-data permissions?

[SOLVED] Can't Post Files to /var/www using Filezilla via SFTP on ...

Amir Rahwane
  • 604
  • 8
  • 7