2

Trying to set up WinSCP so I can have SFTP access to my instance running off Compute Engine and using these directions. However when reading over the instructions here, I am confused about how to handle the prepending of the the username to the beginning of the key.

Won't that make the key information different from the key generated from the winscp's instructions as follows?

  • Enter your GCE username to Key comment box.
  • Copy a contents of Public key for pasting to OpenSSH authorized_keys file to the clipboard (note that the contents includes your username);

The WinSCP's directions adds the username to the end of the key. And Google requires a prepend of the username. So in Metadata->User, I edit my Username's SSH key to prepend the user name, but it's not working out.

After I finish the step of adding the private key file to SSH>Authentication page and try to log in, I get an Authentication failure.

Falcon Momot
  • 24,975
  • 13
  • 61
  • 92

1 Answers1

2

You prepend the username to the beginning of the key if you want to use gcloud command to add the key to the metadata:

$ gcloud compute project-info add-metadata --metadata-from-file sshKeys=my-ssh-keys.pub

If you're adding manually, skip prepending the username.

Kamran
  • 1,415
  • 7
  • 16