Different username with oslogin enabled - clarification needed
See original GitHub issueI created a VM instance (Ubuntu 18.04) using the web interface. The Ubuntu username I was given was the same as the username part of the gmail address I am logged in with (project owner, no organisation): username.
I then enabled OS Login to be able to use a third party SSH client - specifically, I wish to be able to ssh username@external.ip from my local console.
With OS Login enabled, I used gcloud to upload an SSH key to my project’s metadata, after having logged in with that same gmail address again (following gcloud auth login). The username in that specific key is that same (full) gmail address. The output of the gcloud ssh-keys add command showed as username: username_gmail_com, rather than username.
I then found that I can only ssh using this new Ubuntu username: username_gmail_com. This new Ubuntu user has been created on my VM and logging in using the web interface also takes me to this new user.
When I disable OS Login again, I’m taken to the old username through the web interface. I can’t use local ssh command (of course).
I can solve this discrepancy and the inconvenience it causes by creating a new VM while having OS Login enabled.
However, I’m looking for clarification:
- Why is the username different when enabling OS Login?
- Why
user_gmail_comrather than justuser?
I’d be grateful for an explanation.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:9 (5 by maintainers)

Top Related StackOverflow Question
I’ve read both and from where I am now clarity has much improved. 👍
I would like to suggest to add to this text that the individual user is unable to change the default username. For example:
(Feel free to change the wording if it’s inappropriate, English is not my native language. My aim was to use an active form, staying away from negative verbs such as “can’t”.)
While I’m at it, in the chapter “Configuring OS Login roles on user accounts”, bullet point 1: “Users must have the following roles:” the role “roles/iam.serviceAccountUser” is mentioned.
osLoginandosAdminLogin. I found that under “Service Accounts”, I was offered “serviceAccountUser” as well as “serviceAccountAdmin”. Either this role could be added to the bullet point, or if it’s an inappropriate role this should probably be mentioned.For bullet point 1, I suggest something like:
Or:
I hope this helps. Either way, thanks for updating the docs.
Please take a look at the public docs for Managing OS Login in an Organization for information on setting POSIX information for G Suite users. Please feel free to send feedback on any of the public docs if there are gaps in the information they provide.