Score:0

Log into Google Cloud VM with as specific user using IAM

ru flag

I created a VM with an Ubuntu 22.04 image and I log in using IAM credentials, not SSH keys, for example:

gcloud beta compute ssh --zone myzone vmname --project myproj --tunnel-through-iap

My command prompt has the username I want.

I just created another VM and it is using my default username ariel_balter_gmail_com.

I have no idea what I did with the first VM to make my username the one I want.

On the first machine, I see:

(base) balter@???????:~$ ls /home
balter  ubuntu

and

(base) balter@????????:~$ cat /etc/passwd | grep balter
balter:x:1001:1002::/home/balter:/bin/bash

On the second machine I created a user "balter", and I see:

(base) ariel_balter_gmail_com@???????:~$ ls /home
ariel_balter_gmail_com  balter
(base) ariel_balter_gmail_com@??????:~$ cat /etc/passwd | grep balter
balter:x:1000:1001:,,,:/home/balter:/bin/bash

I did something different, and I have no idea what.

かいぜん avatar
pm flag
use this command `gcloud projects get-iam-policy MY_PROJECT` to list all Users and Service accounts in a project with their IAM roles, and Identify if the other account is also the Owner.
ru flag
@JonB The only owner is `user:[email protected]`.
Score:1
cn flag

A Google Cloud IAM identity does not have the same format as a typical SSH Linux identity. Therefore separate home directories are created.

Your Linux machine has two users setup: balter and ariel_balter_gmail_com. The first was probably created as a Linux user for SSH and the other by Google Cloud. They are different identities as far a Linux is concerned.

You also cannot control the user identity string that IAM uses. It is created from the IAM email address.

ru flag
I don't know of anything different I did setting up machines 1 and 2. Except, I added a `balter` user to machine 2 for my own convenience, and `su balter` as soon as I log in. Can you think of anything I might have done differently when I created the VMs?
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.