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
- 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.
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!
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”.
That’s it! You can now remotely access your server.