I'm running an instance on debian-7-wheezy and I'm sort of new to the Google Compute Engine.
I have looked through both the support requests on this site and the FAQ post on the Google website; however I found nothing that I could follow completely.
I know a small amount about Linux (managed a dedicated Debian box for about 6 months), but I can't access SSH from my home PC either.
I would love a step-by-step walkthrough on how I can go about accessing FTP/SFTP using WinSCP (or another file browser) and how I can access SSH from my home PC using Putty from creation of the instance to connection to the instance.
Thank you in advance for your help and sorry for being a newb.
Using gcloud (provided as part of Google Cloud SDK) connect to your instance using SSH.
gcloud compute ssh instancename
If you are connecting for the first time, this will prompt you to create SSH keys. As part of this this will also create .ppk
file which will be used to Putty to SSH into your instance.
Download and Install FileZilla
Goto Edit->Setting->SFTP
Click on Add Key File button, and point it to the PPK file generated.
Once this is done, you can connect to your instance using FileZilla SFTP. Specify your instance's public IP address in the host field (stfp://instanceipaddress). You would not need to specify any password.
Looks like a similar question to this one , Adding same answer here too
At a high level, these are the steps:
- Install and run the gcloud SDK (
$ gcloud init
)
- Generate SSH key (
$ gcloud compute ssh
)
- Setup the FTP client (install and add the key file)
- Connect to the VM using the SFTP client
Assuming this question was asked here before this documentation from Google was available.
Also, I have recorded this, it might be helpful:
https://www.youtube.com/watch?v=9ssfE6ODpak
And just an FYI .. if the files that you need to transfer are pretty small in size then maybe you don’t need a SFTP client. Transfer directly from the console as seen here https://youtu.be/HEdXEEYOynE
When you bring up VM on GCP you should update firewall rules:
- IN: TCP 20,21,60000-65535
- OUT: TCP 20,21,60000-65535
Then update FTP to use passive port range 60000-65535.
Then on client side use Passive mode.
Details and instructions (Russian) - http://sysadm.pp.ua/linux/proftpd-ubuntu-16-04.html
In order to setup SFTP you can follow the steps mentioned in the following article.
http://www.howtoforge.com/mysecureshell_sftp_debian_etch
To setup putty for GCE instance you need to create a key pair and upload the public key to the metadata server using your developer console. You can find the steps on this article https://developers.google.com/compute/docs/console#sshkeys
To generate a new SSH key-pair on Windows workstations:
- Download puttygen.exe.
- Run PuTTYgen. For this example, simply run
the puttygen.exe file that you downloaded. A window opens where you
can configure your key generation settings.
- Click the Generate
button to generate a new key-pair. For most cases, the default
parameters are fine. When you are done generating the key-pair, the
tool displays your public key value.
In the Key comment section,
enter your Google username. The key should have the following
structure:
ssh-rsa [KEY_VALUE] [USERNAME] where:
[KEY_VALUE] is the key value that you generated. [USERNAME] is your
Google username.
- Optionally, enter a Key passphrase to protect your
key.
- Click Save private key to save the private key to a file. For
this example, save the key as my-ssh-key.ppk.
- Click Save public key
to write your public key to a file for use later. Keep the PuTTYgen
window open for now.
Go to the metadata page for your project.
Click
SSH Keys to show a list of project-wide public SSH keys. Click the
Edit button so that you can modify the public SSH keys in your
project.
- Copy the entire public key value from the PuTTYgen tool and
paste that value as a new item in the list of SSH keys on the
Metadata page. The public key value is available at the top of the
PuTTYgen screen:
- click Save to save your new project-wide SSH key.
The public key is now set to work across all of the instances in
your project. Use FileZila/Putty to connect to your instances as demonstrated in the videos now.
For those using Mac, go to FileZilla > Settings > SFTP > Add Key File... and then select your private key (the one with no extension), and then FileZilla will convert it to a ppk file.
And then you will be able to connect to the vm without password :)