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?
Best Answer
(I cannot comment to your question due to insufficient reputation.)
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 :
To create a new key in server
ssh-keygen -t rsa -b 2048 -v
Follow the instruction including key location and key passphrase.
Append new key to authorized_keys
cat /your/key/path/key.pub >> ~/.ssh/authorized_keys
Rename private
key
into.pem
extension (optional)chmod 400 [KEY]
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.