Share on facebook
Share on twitter

Google Cloud SFTP Setup with FileZilla (with screenshots)

Do you want to transfer files from your computer (PC) to Google Cloud Instances with Filezilla?  Then don’t worry I am here to help you.

FileZilla is a free software, cross-platform FTP / SFTP application, Two different versions of it is available one is Filezilla client and another Filezilla server. You will be using Filezilla client in this tutorial. Filezilla client is available for Windows and macOS.

How to transfer file to Google Cloud with FileZilla?

Basically there are two ways which you can follow to transfer files to Google Cloud with Filezilla. First, using FTP (File Transfer Protocol), but Google Cloud  VM instance does not come with a pre-installed FTP server, so you have to set up an FTP server, in order to connect to Google Cloud using FTP. Here is a blog of mine which help you to Set up an FTP server on GCP. Second, using SFTP (SSH File Transfer Protocol) which we are going to discuss in the blog. SFTP is more secure than FTP and because Google Cloud instance came with SSH, you don’t need to install anything on your VM instance to transfer files using SFTP with Filezilla.

Here are the steps to set up SFTP with Filezilla on Google Cloud,

Step 1: Downloading PuTTY and FileZilla

The first step in this tutorial is to download PuTTY and FileZilla.

PuTTY is a  (free and open-source) SSH and telnet client, it helps us to open terminal emulator via SSH.  But in this tutorial we don’t using Putty rather its handy extra application name, PuTTYgen. Later in this tutorial we’ll use PuTTYgen to generate RSA Keys.

FileZilla is a free software, cross-platform FTP application. The FileZilla Client not only supports FTP, but also FTP over TLS (FTPS) and SFTP. Later in this guide we’ll show you how to configure Filezilla to transfer files to Google cloud.

Step 2: Generating RSA SSH keys

After you have downloaded and installed PuTTY on your local computer, It is time to generate RSA Public and Private keys. RSA Public and Private keys often called by SSH keys.

Now click on your window button. Then search and open PuTTYgen to generate Public and Private keys.

Click on “generate” and move your mouse to create SSH key pair (public and private keys).

I recommended you to change the key comment field to something recognizable and easy to type, as this will become a user name later!

This part is one of the most important step of this tutorial.

We are going to save the generated private key to our local computer. Later we going to use this private key to configure FileZilla.

Click on the “Save private key” button to save the private key on your computer.

In this step we are going to copy the public key, and in the next, going to apply it to your project or instance.

In the top, just under the Key section, copy the whole “Public key for pasting into OpenSSH authorized_keys file:” data. This is your public key. You also press “Save public key” to store it on your computer.

Step 3: Appling Public key to Google Cloud

In this step we are going to apply the SSH Public key to Google Cloud. There are two ways of doing it, either you can apply it to google cloud project(s) metadata or your VM instance(s) SSH keys section.

If you add the public key to project(s) metadata, Google Cloud will automatically apply it to all the VM instances (under your project). But if you add the public key to your VM instance(s) SSH keys section, it will enable SFTP for only that particular VM instance.

1. Adding Public key to Google Cloud Project(s) Metadata

Click on the hamburger menu in the upper left-hand corner of your Google Cloud Platform dashboard.

Now, navigate to Compute Engine >> Metadata >> SSH keys.

After that Click on Add item and Paste the  Public key which you copied from the puttygen application. Then click on the save button.

The metadata public key will work for all the VM instances.

2. Adding Public key to Google Cloud VM instance

Click on the hamburger menu in the upper left-hand corner of your Google Cloud Platform dashboard.

After that, navigate to Compute Engine >> VM Instances.

Open the setting section by clicking over the name of your VM instance.

Click on the edit Button.

After that scroll down and click on the “Show and edit” Button.

You need to paste the Public key which you copied earlier from the puttygen application.

Now, click “Save” to apply the public key to only this instance.

Step 4: Appling Private key to Filezilla

In this step we are going to add the private SSH key to Filezilla(S) settings section.

Open the Filezilla Client application which you have already downloaded and installed on your local computer. Now, navigate to Edit >> Settings.

  1. – Navigate to Connection >> SFTP.
  2. – Click the “Add key file..” button.

Now, select the private key file which you saved from PutTTYgen.

3. – Click the OK button to apply the private key to FileZilla.

Step 5: Configuring FileZilla

In this step we are configuring FileZilla to make a connection to Google cloud.

On your Filezilla client application, navigate to File >> Site Manager.

  1. – To a new project, click on New Site.
  2. – Give a name (optional)

After that, Select “SFTP – SSH File Transfer Protocol” from Protocol field.

3. – Go to you google cloud (s) dashboard and copy your VM instance External IP address.  Now, Paste the IP address to the Host field (filezilla).

4. – Type the username or key-comment (which you get from PuTTYgen application) on the “User:” field.

5. Press the “OK” button to apply the settings to Filezilla.

Step 6: Connecting to Google Cloud

On your Filezilla client application, again navigate to File >> Site Manager.

After that, click on “Connect” to connect to google cloud via SFTP.

If  you have successfully connected to GCP , you will see an output similar to the image above. Because I used username (as key-comment and later type it on Filezilla’s host section), I connected to /home/username directory.

Step 7: Transferring Files to Instances

Once, you have successfully connected to Google Cloud using Filezilla, It is time to check whether you can or cannot transfer a file to your Instances.

Just drag and drop a file  from your local computer to /home/your-username(key-comment). 

If the file transfer was successful, then you will see an output similar to the image above.

Here I transfer wp-config.php file from my pc to  VM Instance (s) /home/username directory. 

If your file transfer failed then check the Troubleshooting Step for more information. 

Step 8: Troubleshooting Filezilla errors

If you file transfer failed or seeing “permission denied” error, its probably because of “Linux user and group permissions” system.

Here is the Filezilla(s) error,

Error /...  : open for write:permission denied

Error File transfer failed

I assume that you’re seeing this error when you tried to edit or transfer a file other than /home/your-key-comment(username) directory. In Linux system every file and directory have a owner and group, if the file or directory does not belong to your key-comment(username) then you can not edit or upload files. 

To solve permission denied error of filezilla follow this tutorial below,

Now it is your time!

I tried my best to provide you a complete tutorial on how to set up SFTP on Google Cloud with Filezilla. I hope you liked it.

If you need help just drop a comment.

If you benefited from this tutorial, and would like to support my work, please like my Facebook page.


Leave a Comment

Your email address will not be published. Required fields are marked *