0

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.

abalter
  • 121
  • 6
  • 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. – かいぜん Nov 17 '22 at 00:11
  • @JonB The only owner is `user:ariel.balter@gmail.com`. – abalter Nov 17 '22 at 00:30

1 Answers1

1

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.

John Hanley
  • 4,754
  • 1
  • 11
  • 21
  • 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? – abalter Nov 17 '22 at 23:35