I still don’t understand GCP account clearly. GCP account is a gmail address?
What is the difference between GCP account and GCE VM account?
When I first time create a GCE instance, I tried to use putty to login VM like I use other VPS.
But I found there is no VM account provided. I know we can use ‘google could shell’ and ‘ssh key’ to login. I still want to try to create a VM account to login. But I failed.
My question is whether we can create a VM account? It also is created by IAM or just created inside VM? I didn’ really understand ‘OS login’ setting.
And is there any relationship between this VM account and GCP account.
GCP account is purely a Google account using on GCP services, so yes it’s a Gmail address too.
A GCP account is totally different from a GCE VM account (or it should be called an OS account to be exact). GCP account is for you to use GCP services, while OS account is for you to log in to the OS environment inside the VM.
Unlike other platform where you will normally define a username (and password) at the creation of VM, when a new GCE instance is created it doesn’t have any OS account within.
The only exception is that if your GCP project (where GCE instance belongs to) have project-wide SSH keys and your new instance is Linux-based, all project-wide SSH keys (with corresponding username inside the key) will be populated to your instances. You can prevent this auto-population by toggling the "prevent project-wide SSH keys" during the instance creation.
Assuming that the instance is Linux-based, after the creation you can either connect to that instance by clicking the [SSH] button or using
gcloud command via Cloud Shell. When doing that, the Service Account for Compute Engine will create OS account (or Linux user to be exact) and put it to your instance.
Of course you can pre-create the account you want with several ways:
Use the startup script section to create user
Put your own SSH key (public key only) into instance’s metadata. The public key will also contain the username that you want it to be. You have to create an SSH keypair on your own. If using this method, you would want to disable the project-wide SSH keys feature.
Create your own VM image with pre-created username.
Hope that can answer your concerns 🙂