When I run gcloud compute config-ssh, it adds entries of my ~/.ssh/config file as:
Host <instance-name>.<region>.<project>
HostName <instance-ip>
IdentityFile ~/.ssh/google_compute_engine
UserKnownHostsFile=~/.ssh/google_compute_known_hosts
HostKeyAlias=compute.<some-num>
IdentitiesOnly=yes
CheckHostIP=no
Now while this works great for me to ssh into the VM as the current user, ie $USER, after creating a new user (say user1 ) on the VM, if I try to ssh to it after adding my key to it, I am unable to do so:
> ssh user1@<full-machine-name>
This is because the config entry made tells the ssh client to use the google identity key, even though it is not applicable for the user.
Post this, if I go and manually add the Match user $USER field to the ssh config entry for the host, everything works as expected.
Is this an issue only I am facing because I am doing something the wrong way / missing out on something or is this a bug in the SDK?
Also, in case this is really a bug, what would be the best automated workaround where I don't have to perform any manual steps?