I recently created a VM instance on the Google Cloud Platform and attempted to connect to it using WinSCP via the following steps:

  1. Created a ssh key pair using puttygen with [my_username]@gmail.com as the key comment.
  2. Pasted the generated public key in the SSH Keys section using 'add item' and saved.
  3. Started the VM instance.
  4. Opened WinSCP.
  5. Started a new session and add the external ip of the VM instance as the hostname and [my_username] as the username.
  6. Under advanced settings in authentication under SSH I loaded the private key that I generated.
  7. Tried to connect
  8. Encountered this error

I'm not sure what I'm doing wrong here.


I found the answer in the Troubleshooting SSH" section of the Google Cloud Documentation. https://cloud.google.com/compute/docs/troubleshooting/troubleshooting-ssh

The issue was "OS Login is enabled on the instance. You cannot use both SSH Keys and OS Login to connect to an instance. If OS Login is enabled, then connecting with metadata-based SSH keys is disabled."

Once I changed the enable-oslogin in metadata to FALSE the problem was solved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.