Add "User" to each host in ~/ssh/config with `gcloud compute config-ssh` command
Connections to the VM with OpenSSH only succeed if the correct username is given. Otherwise it returns "Permission denied (publickey)".
Some external tools, e.g. Ansible, use the SSH config file resp. the SSH agent.
Adding the "User" to each "Host" entry would be help here. Then it's also not required to add it somewhere in the tool config (if possible at all) and therefore these configs can easier be shared without user state in it.
Thanks, we’ll take a look.
Ruijian Cao commented
I support Nathan Pierce suggestion
Nathan Pierce commented
Second this, but I'd love a flag to set what config-ssh puts in the .ssh/config: My local machine username is nathanpierce, yet nathan_pierce is the user I need to connect with if I want to be able to `sudo su -` on the host.