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.