Set up your own (free!) SFTP server using Google Cloud Platform

Create your own quick and dirty server with SFTP capability with Google Cloud Compute Engine. This method isn’t the most secure since it allows users to authenticate to the server via password login rather than using secure keys.

We’ll start by setting up a cloud server using Google Cloud Platform (GCP). Then, we’ll set up a username and password to access our server. Last, we’ll connect to and test our server.

What you’ll need:

Similar to FTP, SFTP is SSH (secure shell) File Transfer Protocol. SFTP is not a place where you store files. Rather, it’s a separate protocol that allows secure files transfers and the ability to traverse the filesystem on a remote server. Learn more about SFTP here.

Step 1 — Set up a cloud server

Create a VM instance on Google Cloud Platform Compute Engine > VM Instances

Select “Compute Engine” from the menu, then “VM instances”.
Select the “Create Instance” button.
Select your Machine type to the whichever option suits your needs, then for Boot disk select “CentOS”.

Why CentOS?

- The SSH server is installed and enabled.

- The SSH server configuration is set to disable password authentication, ServerAliveInterval and ClientAliveInterval are set to 7 minutes to prevent SSH disconnections, and root login is disabled via SSH.

Since the SSH server is installed and enabled, all we have to do is set password authentication to enabled.

Step 2 — Add a username and password for ssh login

Select the SSH > Open in Browser Window.

A terminal will appear, connected to your VM instance. Congrats!

Now, we’ll want to add a new user and password for logging into our server remotely. Follow these commands making sure to fill in the bold with the appropriate information:

This example creates a new user called “username”, but you should replace it with a user name that you like:

[bianca@instance-1 ~] sudo adduser username

Next, assign a password to the new user (again, substitute “username” with the user that you just created):

[bianca@instance-1 ~] sudo passwd username

Enter a strong password, and repeat it again to verify it.

Step 3 — Enable Password Authentication

Great! Now we have a user and a password. All we have to do is enable password authentication in the ssh config file.

Edit the sshd_config file using the vi editor program, which is located in /etc/ssh/ folder, by typing:

[bianca@instance-1 ~] sudo vi /etc/ssh/sshd_config

To edit the file, type i (for insert). Then, comment out the PasswordAuthentication no, and uncomment the PasswordAuthentication yes. Your file changes should now look like this:

# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication yes
#PermitEmptyPasswords no
#PasswordAuthentication no

Next, save the file by hitting ESC, then typing: :wq (that’s a colon, the letter w and q, to overwrite/save file and quit), and hitting ENTER.

You can exit the terminal. Back on GCP, select stop. Now, start it back up again.

You’ll notice you have an External IP which we’ll user in the next step to connect to our server.

Step 4 — Connect to and test your server with Cyberduck

We’re ready to connect to our server via Cyberduck.

Click “Open Connection”, then from the dropdown list select “SFTP (SSH File Transfer Protocol).

For Server:, enter your External IP from GCP from the previous step. Then enter your username and password. Hit “Connect”. You’ll see a unknown fingerprint alert, you can check “Always”.

Create a new SFTP connection on Cyberduck

That’s it! You can now remotely access your server.

View, upload, or download files by dragging and dropping on Cyberduck

Bianca Loren Padilla

Written by

Co-founder & CEO of Care.Club. Constantly learning & implementing new cost-effective technologies to deliver the best e-commerce experience for our customers.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade