Add SFTP User Permissions In Google Compute Engine

Adding FileZilla SFTP permissions to a Google Compute Engine (GCE) instance can be a little tricky. When using WordPress on GCE it’s really hard to deal with files if you can’t use FileZilla. This took me several days to finally figure out. Maybe it’s a simple hack to those familiar with command-line but that wasn’t me.

There was no forum or other site posting how to do this. It seems that if you can SSH into the GCE instance you should be able to also SFTP from FileZilla. However, that is not the case. You can read the files but can’t upload files.

So here is what worked for me:

I was logged in via the GCE SSH browser available through the console.

I added my user “david” to the group www-data, which is the Apache group.

sudo usermod -g www-data david

then I made sure I had write access:

sudo chgrp -R www-data /var/www/html
sudo chmod -R g+rwx /var/www/html

Hopefully, this will save you some time. If you brick your instance don’t complain to me. lol Make sure you take a snapshot before modifying anything. 🙂