In this article we will configure SFTP connectivity between local linux machine and google cloud vm. However steps will be same for any other operating system like windows, mac etc. This article builds upon previous tutorial where we have established ssh connectivity between local machine and google cloud vm. It is prerequisite to first establish ssh connection and then follow this tutorial.
Test SSH connectivity with Google VM
We assume that you have configured key based ssh connection with google cloud vm. Before setting up sftp connection please get external ip address of google cloud vm and test you ssh connection like below. If you are on windows then you can use external client like putty or use windows powershell to test ssh connectivity.
techmonger@ubuntu:~$ ssh 93.184.216.34
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sun Aug 12 10:34:49 2018 from (ip-address)
techmonger@google-vm:~$
Test SFTP Connection
If you are able to ssh google compute vm from your machine then you should also be able to perform sftp from the same machine. Test your sftp connection like below.
techmonger@ubuntu:~$ sftp techmonger@93.184.216.34
Connected to 93.184.216.34..
sftp> pwd
Remote working directory: /home/techmonger
From here on you can use basic FTP commands like PUT
to upload files and GET
to download files. However if you want to do file transfer with more ease then you should use ftp client like filezilla or winscp to perform operations. Below we will configure sftp connection with google instance using filezilla.
SFTP using Filezilla
Install filezilla or any other GUI based FTP client on your local machine. If you are on ubuntu then you can install filezilla from command line with below commands.
Install FileZilla
sudo apt update
sudo apt install filezilla
Open FileZilla
Create SFTP Connection
From filezila menu select Site manager and from site manager pop up select New Site.
Provide following authentication details.
Host | External IP Address of VM (93.184.216.34) |
Port | Leave Empty (Default) |
Protocol | SFTP |
Logon Type | Interactive |
Username | Local User Using Which Key Based Authentication was configured (techmonger) |
Password | Leave Empty |
If you have provided correct authentication details then you should be able to initiate SFTP
connection with google cloud vm.
Conclusion
We have configured sftp connection between google cloud instance and local machine based on existing ssh connectivity. We have initiated SFTP connection using GUI client FileZilla. However you can use any other GUI client which support interactive sftp authentication and connect to your cloud server.