Accessing FTP on Google Compute Engine

2019-03-15 10:53发布

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.

6条回答
Emotional °昔
2楼-- · 2019-03-15 11:21

To generate a new SSH key-pair on Windows workstations:

  1. Download puttygen.exe.
  2. 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.
  3. 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.
  4. 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.

  5. Optionally, enter a Key passphrase to protect your key.
  6. Click Save private key to save the private key to a file. For this example, save the key as my-ssh-key.ppk.
  7. Click Save public key to write your public key to a file for use later. Keep the PuTTYgen window open for now.
  8. Go to the metadata page for your project.

  9. 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.

  10. 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:
  11. 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.
查看更多
我只想做你的唯一
3楼-- · 2019-03-15 11:25

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.

enter image description here

And then you will be able to connect to the vm without password :)

查看更多
霸刀☆藐视天下
4楼-- · 2019-03-15 11:28

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

查看更多
唯我独甜
5楼-- · 2019-03-15 11:29

Looks like a similar question to this one , Adding same answer here too

At a high level, these are the steps:

  1. Install and run the gcloud SDK ($ gcloud init)
  2. Generate SSH key ($ gcloud compute ssh)
  3. Setup the FTP client (install and add the key file)
  4. 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

查看更多
Bombasti
6楼-- · 2019-03-15 11:32

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.

查看更多
兄弟一词,经得起流年.
7楼-- · 2019-03-15 11:44

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

查看更多
登录 后发表回答