I have an UBUNTU 14.04 LTS VM that I was able to ssh into using normal SSH user with a password. After I rebooted the password is not being accepted. This is the only plain user account on the system.

I have tried using GCP SSH, both from the command line and using the GCP web as well as the serial console with no luck.

This VM was migrated from an Azure platform and does not have the GCP daemon on it (or it doesn't work) but it has always had plain SSH login just fine until now.

This is the tail of the ssh -v for the method that has always worked before.

debug1: Next authentication method: password
mi2@mii21.mi-squared.com's password: 
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.

I added my public key directly to the GCP VM instance hoping that would get me in using my google user account (like on most of the the other VMs I created via GCP) but that does not work either.

-- The VM serial console output may provide details to aid in troubleshooting connection problems. 

Serial console ONLY shows activity from the last plain login attempt, so I suspect GCP daemon is not running on the instance at all.

Is there some method to create a alternative login or some other options anyone can suggest?

  • NOTE: I have access now, but for the sake of learning something I would like any feed back people may have. I remembered that a former employee and current contractor for me had a account and I was able to reset the login pwd. What I do not understand is what GCP is doing to the pwd table when rebooted? This does not happen all the time but it is not the first time. – user3796508 Aug 14 '17 at 2:50

(I cannot comment to your question due to insufficient reputation.)

Is there some method to create a alternative login or some other options anyone can suggest?

I'm not sure whether that my understanding is correct or this answer will satisfy your question or not. I did a trick with ssh with pem file to GCE. The instance is required to have non-ephemeral IP address, let's say static IP address. As I can share this private key to my colleague (do it with your own risk of the leaking key).

Here's the steps to setup ssh with key file :

  1. To create a new key in server ssh-keygen -t rsa -b 2048 -v

  2. Follow the instruction including key location and key passphrase.

  3. Append new key to authorized_keys cat /your/key/path/key.pub >> ~/.ssh/authorized_keys

  4. Rename privatekey into .pem extension (optional)

  5. Copy private key file to remote machine and set permission to 400 chmod 400 [KEY]
  6. Test ssh connection with key file ssh -i [KEY(.pem)] [USER]@[HOST IP]

Edit: As @faizan indicated in comment if do not have serial console access to the VM, try adding the ssh keys to the ~/.ssh/authorized_keys using startup script.

That's it.

PS. Google compute engine create user per session if you not identified username. It depends on Google cloud SDK credential that you use. But log in with private key should work fine for ssh for any machine.

| improve this answer | |
  • That would only work if you could login to the remote VM at all, which (at the time) I could not. – user3796508 Aug 17 '17 at 15:44
  • Can you log in via ssh button on Google Cloud Console web browser? I think that, most of time, if I cannot shell to my instance, I can always use ssh button from web page to get access to it. – Fony Lew Aug 18 '17 at 4:09
  • btw, have you install gcloud sdk on your system yet? That would help you to use GCP more inconveniently – Fony Lew Aug 18 '17 at 4:11
  • 1
    If you cannot ssh to the VM, you try to add the ssh keys to the ~/.ssh/authorized_keys file using a startup script. – Faizan Aug 22 '17 at 23:18

You can alternatively login to your VM using serial console Google Serial Console. From here, you can go ahead and configure gcloud sdk and anything else

| improve this answer | |

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.