Are you getting Permission denied errors when trying to edit your Google Cloud Platform files via FTP?
In this tutorial you will learn how to fix Permission denied errors that occur when trying to save and upload changes to Google Cloud Platform files that you’ve downloaded and edited over FTP.
Before starting this tutorial, you should have already configured an FTP client to work with your website on Google Cloud Platform.
There are 6 steps in this tutorial:
1. Identify Error
What is a Permission denied error in FTP, and what does it look like?
Permission denied errors occur when you don’t have the required permissions to make changes to a file that you’re trying to edit over FTP.
2. Connect to VM Instance
In order to fix the problem, you will need to edit the file’s permissions in Google Cloud Platform. This requires you to connect to your VM instance using the SSH (Linux Shell) terminal.
3. Check File Permissions
Now that you’ve connected to your website via SSH, the first step is to check the permissions of the file you want to edit. In this example, the user would be checking the permissions of the wordpress.conf file.
To do this, execute the following command:
stat -c "%a %n" /path/to/file
4. Edit File Permissions
Because the file’s permissions are set to 644, you would not have sufficient permissions to edit the file via FTP. To fix this problem, you are going to change the file’s permissions from 644 to 777, thereby granting all permissions.
To do this, run the following command:
sudo chmod 777 /path/to/file
5. Restart Apache
For changes to take affect, you will need to restart your Apache server.
For most Apache configurations, run the following restart command:
sudo service apache2 graceful
For Bitnami Apache configurations, run the following restart command:
sudo /opt/bitnami/ctlscript.sh restart apache
6. Retry File Upload
Go back to your FTP Client and try uploading the saved file again. Now that the file has permissions of 777, you will be able to upload it to your server successfully via FTP.
Did it Work?
With the use of chmod 777, you should now be able to avoid Permission denied errors when uploading files via FTP.
If you have any questions or comments, please post them below!